ddg.conversion.nets.geometry.subspaces module

ddg.conversion.nets.geometry.subspaces.subspace_to_smooth_net(subspace, affine=True, convex=True)[source]

Convert a subspace to a smooth net.

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

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=True)

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 a1,…,ak and gives:

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

The basis u0,…,uk is the given basis subspace.points, permuted and dehomogenized: The first vector not at infinity is moved to the first position and last entries ui[-1] of vectors are normalized to either 0 or 1. Note that this can also be written as:

u0 + a1 * (u1 - u1[-1] * u0) + ... + ak * (uk - uk[-1] * 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.

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

If convex is True and subspace is at infinity.

ddg.conversion.nets.geometry.subspaces.parametrize_subspace_convex(subspace)[source]

Get “convex” parametrization of subspace.

Let u0,…,uk be the given basis subspace.points, but permuted: The first vector not at infinity is moved to the first position. Then the parametrization is:

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

= u0 / u0[i]
  + a1 * (u1 - (u1[-1] / u0[-1]) * u0)
  + ...
  + ak * (uk - (uk[-1] / u0[-1]) * u0)
Parameters:
subspaceSubspace
Returns:
Callable float,…,float -> numpy.ndarray
Raises:
ValueError

If convex is True and subspace is at infinity.

ddg.conversion.nets.geometry.subspaces.parametrize_subspace_homogeneous(subspace)[source]

Get homogeneous parametrization of subspace.

See subspace_to_smooth_net() for how this parametrization is defined.

Parameters:
subspaceSubspace
Returns:
Callable float,…,float -> numpy.ndarray