ddg.conversion.nets.geometry.subspaces module

ddg.conversion.nets.geometry.subspaces.subspace_to_smooth_net(subspace, affine=False, convex=False, affine_component=-1)[source]

Convert a subspace to a smooth net.

Parameters:
subspaceddg.geometry.subspaces.Subspace
affinebool (default=False)

Whether the resulting smooth net should return homogeneous or affine coordinates. Note that this works by parametrizing using one of the two parametrizations explained below and then dehomogenizing, so if the parametrization produces points at infinity, you will get errors.

convexbool (default=False)

Which parametrization to use. Let k=subspace.dimension and let the ai be the parameters given to the resulting net.

convex=False takes k+1 parameters and gives

a0 * v0 + ... + ak * vk

where v0,…,vk are the k+1 homogeneous coordinate vectors spanning the subspace given in subspace.points.

convex=True can only be used if the subspace is not at infinity. It takes k parameters and gives:

((1 - a1 * u1[i] - ... - ak * uk[i]) / u0[i]) * u0
+ a1 * u1
+ ...
+ ak * uk

where i is affine_component. The basis u0,…,uk is just the given basis subspace.points, but permuted: The first vector not at infinity is moved to the first position. Note that this can also be written as:

u0 / u0[i]
+ a1 * (u1 - (u1[i] / u0[i]) * u0)
+ ...
+ ak * (uk - (uk[i] / u0[i]) * u0)

If subspace is a point, this parameter has no effect. The returned net will just be a PointNet with the homogeneous or affine coordinates.

affine_componentint (default=-1)

Used to dehomogenize.

Returns:
SmoothNet, SmoothCurve, PointNet or EmptyNet
Raises:
ValueError

If convex is True and subspace is at infinity.