ddg.datastructures.halfedge.surface_generator module
Module ‘surface_generator’ defines some primitive halfedge surfaces
- ddg.datastructures.halfedge.surface_generator.grid(m, n, generate_coordinates=True)[source]
Create a quadrilateral grid with m x n quadrilaterals.
By default, standard coordinates will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Parameters:
- mint
Number of quadrilaterals in first direction.
- nint
Number of quadrilaterals in second direction.
- generate_coordinatesbool, optional
Decides on whether a container like coordinate attribute with default standard coordinates shall be assigned to the vertices.
- Returns:
- ssurface
The created quadrilateral grid.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains some default standard coordinates.
- ddg.datastructures.halfedge.surface_generator.triangle_grid(m, n, generate_coordinates=True, matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))[source]
Create a triangle grid with m x n triangles.
By default, standard coordinates will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Parameters:
- mint
Number of triangles in first direction.
- nint
Number of triangles in second direction.
- generate_coordinatesbool
Decides on whether a container like coordinate attribute with default standard coordinates shall be assigned to the vertices.
- matrixnumpy.ndarray
Standard coordinates get multiplied by this matrix.
- Returns:
- ssurface
The created triangle grid.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains some default standard coordinates.
- ddg.datastructures.halfedge.surface_generator.tetrahedron(generate_coordinates=True)[source]
Creates a tetrahedron.
By default, standard coordinates of a unit tetrahedron will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Parameters:
- generate_coordinatesbool
Decides on whether a container like coordinate attribute with default standard coordinates shall be assigned to the vertices.
- Returns:
- ssurface
The tetrahedron that has been created.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the standard coordinates of a unit tetrahedron.
- ddg.datastructures.halfedge.surface_generator.cube(generate_coordinates=True)[source]
Creates a cube.
By default, standard coordinates of a unit cube will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Parameters:
- generate_coordinatesbool
Decides on whether a container like coordinate attribute with default standard coordinates shall be assigned to the vertices.
- Returns:
- csurface
The cube that has been created.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the standard coordinates of a unit cube.
- ddg.datastructures.halfedge.surface_generator.octahedron()[source]
Creates a octahedron.
By default, standard coordinates of a unit octahedron, centered at [0,0,0], will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Returns:
- ssurface
The octahedron that has been created.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the standard coordinates of a unit octahedron.
- ddg.datastructures.halfedge.surface_generator.dodecahedron()[source]
Creates a dodecahedron.
By default, standard coordinates of a unit dodecahedron, centered at [0, 0, 0], will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Returns:
- ssurface
The dodecahedron that has been created.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the standard coordinates of a unit dodecahedron.
- ddg.datastructures.halfedge.surface_generator.icosahedron()[source]
Creates a icosahedron.
By default, standard coordinates of a unit icosahedron, centered at [0, 0, 0], will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Returns:
- ssurface
The icosahedron that has been created.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the standard coordinates of a unit icosahedron.
- ddg.datastructures.halfedge.surface_generator.icosphere(subdivision_steps=1, radius=1, generate_coordinates=True)[source]
Creates an icosphere.
By default, standard coordinates of a unit icosphere, centered at [0, 0, 0], will be assigned to the vertices and can be accessed via the attribute coordinate
co.- Parameters:
- subdivision_stepsint
Number of subdivisions performed, e.g. 0 for the icosahedron, 1 to subdivide each face of the icosahedron into 4 triangles, 2 to subdivide each face of the icosahedron into 16 triangles and so on.
- radiusfloat
radius of the icosphere
- generate_coordinatesbool
If true, generate coordinates for the icosphere, otherwise don’t generate coordinates.
- Returns:
- ssurface
The icosphere.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the standard coordinates of a unit icosphere.
- ddg.datastructures.halfedge.surface_generator.convexhull_3d(A, join_coplanar_triangles=True)[source]
Creates a halfedge surface of the convex hull of the input points.
- Parameters:
- Aarray
Input array of 3 dimensional coordinates of the form [ , , ] Dimension of the input points has to be three, i.e. non planar.
- join_coplanar_trianglesTrue
If set to True, planar faces will stay triangulated. Otherwise the triangulation will be removed and result in one bigger face.
- Returns:
- ssurface
The convex hull that has been created.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the coordinates of the input.
- ddg.datastructures.halfedge.surface_generator.arrow(resolution=20, generate_coordinates=True, levels=[[0, 0.05], [0.7, 0.05], [0.7, 0.125], 1])[source]
Create an arrow.
By default the the bottom of the arrow is at (0,0,0), it point in the z direction, and has unit length.
- Parameters:
- resolutionint (default=10)
Number of vertices around the center of rotation. Minimum is 3.
- generate_coordinatesbool (default=True)
If true, generate coordinates for the icosphere, otherwise don’t generate coordinates.
- levelslist (default=[[0,0.05],[0.7,0.05],[0.7,0.125],1])
A 4-elements list defining the coordinates. The first three elements define the bottom, the top of the stick and the bas of the head. This three must be a 2-elements list reprensenting the height and the radius. The last element defines the height of the peak of the head.
- Returns:
- ssurface
The arrow.
Notes
Coordinate attribute The coordinate attribute
coassigned to the vertices is of typenumpy.ndarrayand contains the coordinates of the input.
- ddg.datastructures.halfedge.surface_generator.cylinder(resolution=20, fill_caps=True, generate_coordinates=True, top_radius=1, bot_radius=1, length=1, co_attr='co')[source]
Creates a halfedge cylinder aligned along the y-axis.
- Parameters:
- resolution: int (default=20)
Number of faces around the cylinder
- fill_caps: bool (default=True)
If
True, faces are added at the ends of the cylinder.- generate_coordinates: bool (default=True)
If
True, standard coordinates are set toco_attr.- top_radius: float (default=1)
Size of the top of the cylinder, located at (0, length, 0).
- bot_radius: float (default=1)
Size of the bottom of the cylinder, located at (0, 0, 0).
- length: float (default=1)
Size length of the cylinder along its axis.
- co_attr: str (default=’co’)
If
generate_coordinatesis given this is the name of the vertex attribute storing the coordinates.
- Returns:
- The halfedge cylinder.
- ddg.datastructures.halfedge.surface_generator.disc(circle_subdivisions=20, generate_coordinates=True, fill_face=True, center=None, normal=None, radius=1, co_attr='co')[source]
Create a 2-dimensional half-edge circle or disc in 3-dimensional space as a loop of half-edges.
- Parameters:
- circle_subdivisions: int (default=20)
Number of vertices on the boundary of the circle or disc.
- generate_coordinates: bool (default=True)
If True, coordinates are generated and assigned to the vertices as an attribute with the given co_attr name. They depend on center, normal and radius. If False, the half-edge disc is purely combinatoric.
- fill_face: bool (default=True)
Bool to distinguish whether to fill the edge loop with a face or not, i.e. whether to create a disc or a circle
- center: integrable of three floats (default=None)
Center of the circle. Only used if generate_coordinates=True. None defaults to np.array([0, 0, 0]).
- normal: integrable of three floats (default=None)
Normal of the circle. Only used if generate_coordinates=True. None defaults to np.array([0, 0, 1]).
- radius: float (default=1)
Radius of the circle. Only used if generate_coordinates=True.
- co_attr: string (default=’co’)
Name of the vertex attribute that stores the coordinates. Only used if generate_coordinates=True. Depends on center, normal and radius.
- Returns:
- ddg.halfedge.Surface