Faces¶
Surfaces & faces.
- class design3d.faces.BSplineFace3D(surface3d: BSplineSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
Face3D
A 3D face with a B-spline surface.
This class represents a 3D face with a B-spline surface, which is a smooth surface defined by a set of control points and knots. It is a subclass of the Face3D class and inherits all of its attributes and methods.
- Parameters:
surface3d (BSplineSurface3D) – The 3D B-spline surface of the face.
surface2d (Surface2D) – The 2D projection of the face onto the parametric domain (u, v).
name (str) – The name of the face.
- adjacent_direction(other_bspline_face3d)[source]¶
Find directions (u or v) between two faces, in the nearest edges between them.
- adjacent_direction_uu(other_bspline_face3d, corresponding_directions)[source]¶
Returns the side of the faces that are adjacent.
- adjacent_direction_uv(other_bspline_face3d, corresponding_directions)[source]¶
Returns the sides that are adjacents to other BSpline face.
- adjacent_direction_vu(other_bspline_face3d, corresponding_directions)[source]¶
Returns the sides that are adjacents to other BSpline face.
- adjacent_direction_vv(other_bspline_face3d, corresponding_directions)[source]¶
Returns the side of the faces that are adjacent.
- adjacent_direction_xy(other_face3d)[source]¶
Find out in which direction the faces are adjacent.
- Returns:
adjacent_direction
- static approximate_with_arc(edge)[source]¶
Returns an arc that approximates the given edge.
- Parameters:
edge – curve to be approximated by an arc.
- Returns:
An arc if possible, otherwise None.
- face_tolerance = 1e-05¶
- classmethod from_surface_rectangular_cut(bspline_surface3d, u1: float = 0.0, u2: float = 1.0, v1: float = 0.0, v2: float = 1.0, name: str = '')[source]¶
Cut a rectangular piece of the BSplineSurface3D object and return a BSplineFace3D object.
- get_approximating_arc_parameters(curve_list)[source]¶
Approximates the given curves with arcs and returns the arcs, radii, and centers.
- Parameters:
curve_list (list) – A list of curves to approximate.
- Returns:
A tuple containing the radius and centers of the approximating arcs.
- Return type:
tuple
- grid_size()[source]¶
Specifies an adapted size of the discretization grid used in face triangulation.
- linesegment_intersections(linesegment: LineSegment3D, abs_tol: float = 1e-06) List[Point3D] [source]¶
Get intersections between a BSpline face 3d and a Line Segment 3D.
- Parameters:
linesegment – other linesegment.
abs_tol – tolerance.
- Returns:
a list of intersections.
- merge_with(other_bspline_face3d)[source]¶
Merge two adjacent faces.
- Type:
other_bspline_face3d : design3d.faces.BSplineFace3D
- Return type:
merged_face : design3d.faces.BSplineFace3D
- neutral_fiber_points()[source]¶
Calculates the neutral fiber points of the face.
- Returns:
The neutral fiber points if they exist, otherwise None.
- Return type:
Union[list, None]
- pair_with(other_bspline_face3d)[source]¶
Finds out how the uv parametric frames are located.
It does it by comparing to each other and also how grid 3d can be defined respected to these directions.
- Parameters:
other_bspline_face3d (
design3d.faces.BSplineFace3D
) – BSplineFace3D- Returns:
corresponding_direction, grid2d_direction
- Return type:
Tuple[?, ?]
- class design3d.faces.ConicalFace3D(surface3d: ConicalSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
PeriodicalFaceMixin
,Face3D
Defines a ConicalFace3D class.
- Parameters:
surface3d (ConicalSurface3D.) – a conical surface 3d.
surface2d (Surface2D.) – a 2d surface to define the conical face.
- circle_inside(circle: Circle3D)[source]¶
Verifies if a circle 3D lies completely on the Conical face.
- Parameters:
circle – Circle to be verified.
- Returns:
True if circle inside face. False otherwise.
- classmethod from_base_and_vertex(conical_surface3d, contour: Contour3D, vertex: Point3D, name: str = '')[source]¶
Returns the conical face defined by the contour of the base and the cone vertex.
- Parameters:
conical_surface3d – surface 3d.
contour (design3d.wires.Contour3D) – Cone, contour base.
name – the name to inject in the new face
- Returns:
Conical face.
- Return type:
- class design3d.faces.CylindricalFace3D(surface3d: CylindricalSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
PeriodicalFaceMixin
,Face3D
Defines a CylindricalFace3D class.
- Parameters:
surface3d (CylindricalSurface3D.) – a cylindrical surface 3d.
surface2d (Surface2D.) – a 2d surface to define the cylindrical face.
- Example:
contours 2d is rectangular and will create a classic cylinder with x= 2*pi*radius, y=h
- adjacent_direction(other_face3d)[source]¶
Find out in which direction the faces are adjacent.
- Parameters:
other_face3d (design3d.faces.CylindricalFace3D) – The face to evaluation.
- arc_inside(arc: Arc3D)[source]¶
Verifies if Arc3D is inside a CylindricalFace3D.
- Parameters:
arc – Arc3D to be verified.
- Returns:
True if it is inside, False otherwise.
- arcellipse_inside(arcellipse: ArcEllipse3D)[source]¶
Verifies if ArcEllipse3D is inside a CylindricalFace3D.
- Parameters:
arcellipse – ArcEllipse3D to be verified.
- Returns:
True if it is inside, False otherwise.
- classmethod from_surface_rectangular_cut(cylindrical_surface, theta1: float, theta2: float, param_z1: float, param_z2: float, name: str = '')[source]¶
Cut a rectangular piece of the CylindricalSurface3D object and return a CylindricalFace3D object.
- get_geo_lines(tag: int, line_loop_tag: List[int])[source]¶
Gets the lines that define a CylindricalFace3D in a .geo file.
- min_x_density = 5¶
- min_y_density = 1¶
- parametrized_grid_size(angle_resolution, z_resolution)[source]¶
Gets size for parametrized grid.
- Parameters:
angle_resolution – angle resolution.
z_resolution – z resolution.
- Returns:
number of points in x and y.
- planeface_intersections(planeface: PlaneFace3D)[source]¶
Finds intersections with the given plane face.
- Parameters:
planeface – Plane face to evaluate the intersections.
- class design3d.faces.ExtrusionFace3D(surface3d: ExtrusionSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
Face3D
A 3D face with a ruled surface.
This class represents a 3D face with a ruled surface, which is a surface formed by straight lines connecting two input curves. It is a subclass of the Face3D class and inherits all of its attributes and methods.
- Parameters:
surface3d (RuledSurface3D) – The 3D ruled surface of the face.
surface2d (Surface2D) – The 2D projection of the face onto the parametric domain (u, v).
name (str) – The name of the face.
- classmethod from_surface_rectangular_cut(extrusion_surface3d: ExtrusionSurface3D, x1: float = 0.0, x2: float = 0.0, y1: float = 0.0, y2: float = 1.0, name: str = '')[source]¶
Cut a rectangular piece of the ExtrusionSurface3D object and return a ExtrusionFace3D object.
- min_x_density = 50¶
- min_y_density = 1¶
- class design3d.faces.Face3D(surface3d, surface2d: Surface2D, reference_path: str = '#', name: str = '')[source]¶
Bases:
Primitive3D
Abstract method to define 3D faces.
- property bounding_box¶
Returns the surface bounding box.
- divide_face(list_cutting_contours: List[Contour2D], abs_tol: float = 1e-06)[source]¶
Divides a Face 3D with a list of cutting contours.
- Parameters:
list_cutting_contours – list of contours cutting the face.
abs_tol – tolerance.
- divide_face_with_closed_cutting_contours(list_closed_cutting_contours, list_faces)[source]¶
Divides a Face3D with a list of Open cutting contours.
Contours going from one side to another of the Face, or from the outer contour to one inner contour.
- Parameters:
list_closed_cutting_contours – list containing the closed cutting contours
list_faces – list of already divided faces
- Returns:
list divided faces
- divide_face_with_open_cutting_contours(list_open_cutting_contours, abs_tol: float = 1e-06)[source]¶
Divides a face 3D with a list of closed cutting contour, that is, it will cut holes on the face.
- Parameters:
list_open_cutting_contours – list containing the open cutting contours.
abs_tol – tolerance.
- Returns:
list divided faces.
- edge3d_inside(edge3d, abs_tol: float = 1e-06)[source]¶
Returns True if edge 3d is coplanar to the face.
- face_border_intersections(face2)[source]¶
Returns the intersections of the face outer and inner contour with other given face.
- face_decomposition()[source]¶
Decomposes the face discretization triangle faces inside eight boxes from a bounding box octree structure.
- face_inside(face2, abs_tol: float = 1e-06)[source]¶
Verifies if a face is inside another one.
It returns True if face2 is inside or False if the opposite.
- face_intersections(face2, tol=1e-06) List[Wire3D] [source]¶
Calculates the intersections between two Face3D.
- face_intersections_outer_contour(face2)[source]¶
Returns the intersections of the face outer contour with other given face.
- face_minimum_distance(other_face, return_points: bool = False)[source]¶
Gets the minimum distance between two faces.
- Parameters:
other_face – second face to search for minimum distance.
return_points – return corresponding point or not.
- Returns:
- face_tolerance = 1e-06¶
- frame_mapping(frame: Frame3D, side: str)[source]¶
Changes frame_mapping and return a new Face3D.
side = ‘old’ or ‘new’
- classmethod from_contours3d(surface, contours3d: List[Contour3D], name: str = '')[source]¶
Returns the face generated by a list of contours. Finds out which are outer or inner contours.
- Parameters:
surface – Surface3D where the face is defined.
contours3d – List of 3D contours representing the face’s BREP.
name – the name to inject in the new face
- classmethod from_step(arguments, object_dict, **kwargs)[source]¶
Converts a step primitive to a Face3D.
- Parameters:
arguments (list) – The arguments of the step primitive.
object_dict (dict) – The dictionary containing all the step primitives that have already been instantiated.
- Returns:
The corresponding Face3D object.
- Return type:
- fullarc_intersections(fullarc: FullArc3D) List[Point3D] [source]¶
Get intersections between a face 3d and a Full Arc 3D.
- Parameters:
fullarc – other fullarc.
- Returns:
a list of intersections.
- get_closed_contour_divided_faces_inner_contours(list_faces, new_contour)[source]¶
If there is any inner contour, verifies which ones belong to the new divided faces.
- Parameters:
list_faces – list of new faces.
new_contour – current new face outer contour.
- Returns:
a list of new faces with its inner contours.
- get_coincident_face_intersections(face)[source]¶
Gets intersections for two faces which have coincident faces.
- Parameters:
face – other face.
- Returns:
two lists of intersections. one list containing wires intersecting face1, the other those for face2.
- static get_edge_discretization_size(edge3d)[source]¶
Helper function to polygonize the face boundaries.
- get_face_cutting_contours(dict_intersecting_combinations)[source]¶
Get all contours cutting the face, resulting from multiple faces intersections.
- Parameters:
dict_intersecting_combinations – dictionary containing as keys the combination of intersecting faces
and as the values the resulting primitive from the intersection of these two faces return a list all contours cutting one particular face.
- get_face_intersections(face2)[source]¶
Gets the intersections between two faces.
- Parameters:
face2 – second face.
- Returns:
intersections.
- get_geo_lines(tag: int, line_loop_tag: List[int])[source]¶
Gets the lines that define a PlaneFace3D in a .geo file.
- get_open_contour_divided_faces_inner_contours(new_faces_contours, abs_tol: float = 1e-06)[source]¶
If there is any inner contour, verifies which ones belong to the new divided faces.
- Parameters:
new_faces_contours – new faces outer contour.
abs_tol – tolerance.
- Returns:
valid_new_faces_contours, valid_new_faces_contours.
- grid_size()[source]¶
Specifies an adapted size of the discretization grid used in face triangulation.
- static helper_repair_inner_contours_periodicity(surface, outer_contour2d, inner_contours2d, primitives_mapping)[source]¶
Translate inner contours if it’s not inside the outer contour of the face.
- helper_to_mesh(polygon_data=None) Mesh2D [source]¶
Triangulates the Surface2D using the Triangle library.
- Parameters:
polygon_data (Union[Tuple((wires.ClosedPolygon2D), List[wires.ClosedPolygon2D], None]) – Face’s outer polygon.
- Returns:
The triangulated surface as a display mesh.
- Return type:
- static helper_triangulation_without_holes(vertices, segments, points_grid, tri_opt)[source]¶
Triangulates a surface without holes.
- Parameters:
vertices – vertices of the surface.
segments – segments defined as tuples of vertices.
points_grid – to do.
tri_opt – triangulation option: “p”
- Returns:
- is_adjacent(face2: Face3D)[source]¶
Verifies if two faces are adjacent or not.
- Parameters:
face2 – other face.
- Returns:
True or False.
- is_intersecting(face2, list_coincident_faces=None, tol: float = 1e-06)[source]¶
Verifies if two face are intersecting.
- Parameters:
face2 – face 2
list_coincident_faces – list of coincident faces, if existent
tol – tolerance for calculations
- Returns:
True if faces intersect, False otherwise
- is_linesegment_crossing(linesegment)[source]¶
Verify if a face 3d is being crossed by a line segment 3d.
- line_intersections(line: Line3D) List[Point3D] [source]¶
Get intersections between a face 3d and a Line 3D.
- Parameters:
line – other line.
- Returns:
a list of intersections.
- linesegment_intersections(linesegment: LineSegment3D, abs_tol: float = 1e-06) List[Point3D] [source]¶
Get intersections between a face 3d and a Line Segment 3D.
- Parameters:
linesegment – other linesegment.
abs_tol – tolerance used.
- Returns:
a list of intersections.
- linesegment_intersections_approximation(linesegment: LineSegment3D, abs_tol: float = 1e-06) List[Point3D] [source]¶
Approximation of intersections face 3D and a line segment 3D.
- min_x_density = 1¶
- min_y_density = 1¶
- normal_at_point(point)[source]¶
Gets Normal vector at a given point on the face.
- Parameters:
point – point on the face.
- Returns:
- plane_intersections(plane3d: Plane3D)[source]¶
Gets intersections with a 3D plane surface.
- Parameters:
plane3d (Plane3D) – The Plane3D instance to find intersections with.
- Returns:
List of Wire3D instances representing the intersections with the plane.
- Return type:
List[wires.Wire3D]
- point_belongs(point3d: Point3D, tol: float = 1e-06)[source]¶
Tells you if a point is on the 3D face and inside its contour.
- point_distance(point, return_other_point: bool = False)[source]¶
Calculates the distance from a face 3d and a point.
- Parameters:
point – point to verify.
return_other_point – bool to decide if corresponding point on face should be returned.
- Returns:
distance to face3D.
- property primitives_mapping¶
Gives the 3d version of the inner contours of the face.
- rotation(center: Point3D, axis: Vector3D, angle: float)[source]¶
Face3D rotation.
- Parameters:
center – rotation center
axis – rotation axis
angle – angle rotation
- Returns:
a new rotated Face3D
- select_face_intersecting_primitives(dict_intersecting_combinations)[source]¶
Select face intersecting primitives from a dictionary containing all intersection combinations.
- Parameters:
dict_intersecting_combinations – dictionary containing all intersection combinations
- Returns:
list of intersecting primitives for current face
- set_operations_new_faces(intersecting_combinations)[source]¶
Gets boolean operations new faces after splitting.
- Parameters:
intersecting_combinations – faces intersecting combinations dictionary.
- Returns:
new split faces.
- split_inner_contour_intersecting_cutting_contours(list_cutting_contours)[source]¶
Given a list contours cutting the face, it calculates inner contours intersections with these contours.
Then, these inner contours were split at the found intersecting points. :param list_cutting_contours: list of contours cutting face. :return:
- class design3d.faces.PeriodicalFaceMixin[source]¶
Bases:
object
Abstract class for mutualizing methods for faces constructed on periodic surfaces.
- face_inside(face2, abs_tol: float = 1e-06)[source]¶
Verifies if a face is inside another one.
It returns True if face2 is inside or False if the opposite.
- point_belongs(point3d: Point3D, tol: float = 1e-06) bool [source]¶
Checks if a 3D point lies on the face.
- Parameters:
point3d (design3d.Point3D) – The 3D point to be checked.
tol (float, optional) – Tolerance for the check.
- Returns:
True if the point is on the ConicalFace3D, False otherwise.
- Return type:
bool
- class design3d.faces.PlaneFace3D(surface3d: Plane3D, surface2d: Surface2D, reference_path: str = '#', name: str = '')[source]¶
Bases:
Face3D
Defines a PlaneFace3D class.
- Parameters:
surface3d (Plane3D.) – a plane 3d.
surface2d (Surface2D.) – a 2d surface to define the plane face.
- circle_inside(circle: Circle3D)[source]¶
Verifies if a circle 3D is completely inside the plane face.
- Parameters:
circle – the circle to verify.
- Returns:
True if circle is inside False otherwise.
- conicalface_intersections(conical_face: ConicalFace3D)[source]¶
Calculates the intersections between a plane face 3D and Conical Face3D.
- Parameters:
conical_face – the Conical Face 3D to verify intersections with Plane Face 3D.
- Returns:
list of intersecting wires.
- cut_by_coincident_face(face)[source]¶
Cuts face1 with another coincident face2.
- Parameters:
face (Face3D.) – a face 3d.
- Returns:
a list of faces 3d.
- Return type:
List[Face3D].
- cylindricalface_intersections(cylindricalface: CylindricalFace3D)[source]¶
Calculates the intersections between a plane face 3D and Cylindrical Face3D.
- Parameters:
cylindricalface – the Cylindrical Face 3D to verify intersections with Plane Face 3D.
- Returns:
list of intersecting wires.
- distance_to_point(point, return_other_point=False)[source]¶
Evaluates the distance to a given point.
distance_to_point is deprecated, please use point_distance.
- classmethod from_surface_rectangular_cut(plane3d, x1: float, x2: float, y1: float, y2: float, name: str = '')[source]¶
Cut a rectangular piece of the Plane3D object and return a PlaneFace3D object.
- get_geo_lines(tag: int, line_loop_tag: List[int])[source]¶
Gets the lines that define a PlaneFace3D in a .geo file.
- is_adjacent(face2: Face3D)[source]¶
Verifies if two plane faces are adjacent to eachother.
- Parameters:
face2 – other face.
- Returns:
True if adjacent, False otherwise.
- linesegment_inside(linesegment: LineSegment3D)[source]¶
Verifies if a line segment 3D is completely inside the plane face.
- Parameters:
linesegment – the line segment to verify.
- Returns:
True if circle is inside False otherwise.
- static merge_faces(list_coincident_faces: List[Face3D])[source]¶
Merges faces from a list of faces in the same plane, if any are adjacent to one another.
- minimum_distance_points_plane(other_plane_face, return_points=False)[source]¶
Given two plane faces, calculates the points which corresponds to the minimal distance between these two faces.
- Parameters:
other_plane_face – Second plane face.
return_points – Boolean to return corresponding points or not.
- Returns:
minimal distance.
- planeface_intersections(planeface)[source]¶
Calculates the intersections between two plane faces.
- Parameters:
planeface – the other Plane Face 3D to verify intersections with Plane Face 3D.
- Returns:
list of intersecting wires.
- planeface_minimum_distance(planeface: PlaneFace3D, return_points: bool = False)[source]¶
Gets the minimal distance from another PlaneFace3D.
- Parameters:
planeface (PlaneFace3D) – Another PlaneFace3D instance to calculate the minimum distance.
return_points (bool, optional) – If True, returns a tuple containing the two points that give the minimum distance.
- Returns:
If return_points is False, returns the minimum distance between the two plane faces. If return_points is True, returns a tuple containing the two points that give the minimum distance.
- Return type:
float or tuple(float, Tuple3D, Tuple3D)
- point_distance(point, return_other_point=False)[source]¶
Calculates the distance from a plane face and a point.
- Parameters:
point – point to verify.
return_other_point – bool to decide if corresponding point on face should be returned.
- Returns:
distance to planeface3D.
- project_faces(faces)[source]¶
Divide self based on the faces outer, and inner contours.
- Parameters:
faces (TYPE) – DESCRIPTION
- Returns:
DESCRIPTION
- Return type:
TYPE
- toroidalface_intersections(toroidal_face)[source]¶
Calculates the intersections between a plane face 3D and Conical Face3D.
- Parameters:
toroidal_face – the Toroidal Face 3D to verify intersections with Plane Face 3D.
- Returns:
list of intersecting wires.
- class design3d.faces.RevolutionFace3D(surface3d: RevolutionSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
Face3D
A 3D face with a ruled surface.
This class represents a 3D face with a ruled surface, which is a surface formed by straight lines connecting two input curves. It is a subclass of the Face3D class and inherits all of its attributes and methods.
- Parameters:
surface3d (RuledSurface3D) – The 3D ruled surface of the face.
surface2d (Surface2D) – The 2D projection of the face onto the parametric domain (u, v).
name (str) – The name of the face.
- classmethod from_surface_rectangular_cut(revolution_surface3d, x1: float, x2: float, y1: float, y2: float, name: str = '')[source]¶
Cut a rectangular piece of the RevolutionSurface3D object and return a RevolutionFace3D object.
- grid_size()[source]¶
Specifies an adapted size of the discretization grid used in face triangulation.
- min_x_density = 50¶
- min_y_density = 1¶
- class design3d.faces.RuledFace3D(surface3d: RuledSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
Face3D
A 3D face with a ruled surface.
This class represents a 3D face with a ruled surface, which is a surface formed by straight lines connecting two input curves. It is a subclass of the Face3D class and inherits all of its attributes and methods.
- Parameters:
surface3d (RuledSurface3D) – The 3D ruled surface of the face.
surface2d (Surface2D) – The 2D projection of the face onto the parametric domain (u, v).
name (str) – The name of the face.
color (tuple) – The color of the face.
- classmethod from_surface_rectangular_cut(ruled_surface3d, x1: float = 0.0, x2: float = 1.0, y1: float = 0.0, y2: float = 1.0, name: str = '')[source]¶
Cut a rectangular piece of the RuledSurface3D object and return a RuledFace3D object.
- get_bounding_box()[source]¶
General method to get the bounding box.
To be enhanced by restricting wires to cut
- grid_size()[source]¶
Specifies an adapted size of the discretization grid used in face triangulation.
- min_x_density = 50¶
- min_y_density = 1¶
- class design3d.faces.SphericalFace3D(surface3d: SphericalSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
PeriodicalFaceMixin
,Face3D
Defines a SpehericalFace3D class.
- Parameters:
surface3d (SphericalSurface3D.) – a spherical surface 3d.
surface2d (Surface2D.) – a 2d surface to define the spherical face.
- classmethod from_contours3d_and_rectangular_cut(surface3d, contours: List[Contour3D], point: Point3D, name: str = '')[source]¶
Face defined by contours and a point indicating the portion of the parametric domain that should be considered.
- Parameters:
surface3d – surface 3d.
contours (List[design3d.wires.Contour3D]) – Cone, contour base.
name – the name to inject in the new face
- Returns:
Spherical face.
- Return type:
- classmethod from_surface_rectangular_cut(spherical_surface, theta1: float = 0.0, theta2: float = 6.283185307179586, phi1: float = -1.5707963267948966, phi2: float = 1.5707963267948966, name='')[source]¶
Cut a rectangular piece of the SphericalSurface3D object and return a SphericalFace3D object.
- grid_size()[source]¶
Specifies an adapted size of the discretization grid used to calculate the grid_points.
For the sphere the grid size is given in angle resolution in both theta and phi direction.
- min_x_density = 5¶
- min_y_density = 5¶
- class design3d.faces.ToroidalFace3D(surface3d: ToroidalSurface3D, surface2d: Surface2D, name: str = '')[source]¶
Bases:
PeriodicalFaceMixin
,Face3D
Defines a ToroidalFace3D class.
- Parameters:
surface3d (ToroidalSurface3D.) – a toroidal surface 3d.
surface2d (Surface2D.) – a 2d surface to define the toroidal face.
- Example:
contours 2d is rectangular and will create a classic tore with x:2*pi, y:2*pi x is for exterior, and y for the circle to revolute points = [pi, 2*pi] for a half tore
- face_tolerance = 0.001¶
- classmethod from_surface_rectangular_cut(toroidal_surface3d, theta1: float = 0.0, theta2: float = 6.283185307179586, phi1: float = 0.0, phi2: float = 6.283185307179586, name: str = '')[source]¶
Cut a rectangular piece of the ToroidalSurface3D object and return a ToroidalFace3D object.
- Parameters:
toroidal_surface3d – surface 3d,
theta1 – Start angle of the cut in theta direction.
theta2 – End angle of the cut in theta direction.
phi1 – Start angle of the cut in phi direction.
phi2 – End angle of the cut in phi direction.
name – (optional) Name of the returned ToroidalFace3D object. Defaults to “”.
- Returns:
A ToroidalFace3D object created by cutting the ToroidalSurface3D object.
- Return type:
- grid_size()[source]¶
Specifies an adapted size of the discretization grid used in face triangulation.
- min_x_density = 5¶
- min_y_density = 1¶
- planeface_intersections(planeface: PlaneFace3D)[source]¶
Gets intersections between a Toroidal Face 3D and a Plane Face 3D.
- Parameters:
planeface – other plane face.
- Returns:
intersections.
- class design3d.faces.Triangle3D(point1: Point3D, point2: Point3D, point3: Point3D, alpha=1, color=None, name: str = '')[source]¶
Bases:
PlaneFace3D
Defines a Triangle3D class.
- Parameters:
point1 (design3d.Point3D.) – The first point.
point2 (design3d.Point3D.) – The second point.
point3 (design3d.Point3D.) – The third point.
- area() float [source]¶
Calculates the area for the Triangle3D.
- Returns:
area triangle.
- Return type:
float.
Formula explained here: https://www.triangle-calculator.com/?what=vc
- classmethod dict_to_object(dict_, *args, **kwargs)[source]¶
Create a Triangle3D object from a dictionary representation.
This class method takes a dictionary containing the necessary data for creating a Triangle3D object and returns an instance of the Triangle3D class. It expects the dictionary to have the following keys:
- Parameters:
cls – The Triangle3D class itself (automatically passed).
dict – A dictionary containing the required data for object creation.
args – Additional positional arguments (if any).
kwargs – Additional keyword arguments (if any).
- Returns:
Triangle3D: An instance of the Triangle3D class created from the provided dictionary.
- frame_mapping(frame: Frame3D, side: str)[source]¶
Changes frame_mapping and return a new Triangle3D.
- Parameters:
frame – frame used.
side – ‘old’ or ‘new’.
- static get_subdescription_points(new_points, resolution, max_length)[source]¶
Gets sub-description points.
- rotation(center: Point3D, axis: Vector3D, angle: float)[source]¶
Triangle3D rotation.
- Parameters:
center – rotation center.
axis – rotation axis.
angle – angle rotation.
- Returns:
a new rotated Triangle3D.
- subdescription(resolution=0.01)[source]¶
Returns a list of Point3D with resolution as max between Point3D.
- subdescription_to_triangles(resolution=0.01)[source]¶
Returns a list of Triangle3D with resolution as max length of sub triangles side.
- property surface2d¶
Boundary representation of the face.
- property surface3d¶
Gets the plane on which the triangle is contained.
- translation(offset: Vector3D)[source]¶
Plane3D translation.
- Parameters:
offset – translation vector.
- Returns:
A new translated Plane3D.
- design3d.faces.octree_decomposition(bbox, faces)[source]¶
Decomposes a list of faces into eight Bounding boxes subdivided boxes.
- design3d.faces.octree_face_decomposition(face)[source]¶
Decomposes the face discretization triangle faces inside eight boxes from a bounding box octree structure.
- Parameters:
face – given face.
- Returns:
returns a dictionary containing bounding boxes as keys and as values, a list of faces
inside that bounding box.