Faces#
Surfaces & faces.
- class volmdlr.faces.BSplineFace3D(surface3d: BSplineSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
Face3DA 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)#
Find directions (u or v) between two faces, in the nearest edges between them.
- adjacent_direction_uu(other_bspline_face3d, corresponding_directions)#
Return the side of the faces that are adjacent.
- adjacent_direction_uv(other_bspline_face3d, corresponding_directions)#
Return the sides that are adjacents to other BSpline face.
- adjacent_direction_vu(other_bspline_face3d, corresponding_directions)#
Return the sides that are adjacents to other BSpline face.
- adjacent_direction_vv(other_bspline_face3d, corresponding_directions)#
Return the side of the faces that are adjacent.
- adjacent_direction_xy(other_face3d)#
Find out in which direction the faces are adjacent.
- Returns:
adjacent_direction
- static approximate_with_arc(edge)#
Return an arc that approximates the given edge.
- Parameters:
edge – curve to be approximated by an arc.
- Returns:
An arc if possible, otherwise None.
- divide_face(list_cutting_contours: list[Contour2D], abs_tol: float = 1e-05)#
Divides a Face 3D with a list of cutting contours.
DEVELOPER NOTE: method repeated on purspose. It was a way to say that bsplineface needs a specific abs_tol, diferents from other faces.
- Parameters:
list_cutting_contours – list of contours cutting the face.
abs_tol – tolerance.
- extremities(other_bspline_face3d)#
Find points extremities for nearest edges of two faces.
- face_tolerance = 0.001#
- 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 = '')#
Cut a rectangular piece of the BSplineSurface3D object and return a BSplineFace3D object.
- get_approximating_arc_parameters(curve_list)#
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
- get_bounding_box()#
Create a bounding box from the face mesh.
- grid_size()#
Specify an adapted size of the discretization grid used in face triangulation.
- linesegment_intersections(linesegment: LineSegment3D, abs_tol: float = 1e-05) list[Point3D]#
Get intersections between a BSpline face 3d and a Line Segment 3D.
DEVELOPER NOTE: method repeated on purspose. It was a way to say that bsplineface needs a specific abs_tol, diferents from other faces.
- Parameters:
linesegment – other linesegment.
abs_tol – tolerance used.
- Returns:
a list of intersections.
- merge_with(other_bspline_face3d)#
Merge two adjacent faces.
- Type:
other_bspline_face3d : volmdlr.faces.BSplineFace3D
- Return type:
merged_face : volmdlr.faces.BSplineFace3D
- neutral_fiber()#
Return the faces’ neutral fiber.
- neutral_fiber_points(resid_threshold=1e-05, radius_var_threshold=0.25)#
Calculate the neutral fiber points of the face.
- Parameters:
resid_threshold – Maximum allowable residual for the arc approximation.
radius_var_threshold – Maximum allowable variation in the radius.
- Returns:
The neutral fiber points if they exist, otherwise None.
- Return type:
Union[list, None]
- pair_with(other_bspline_face3d)#
Find 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 (
volmdlr.faces.BSplineFace3D) – BSplineFace3D- Returns:
corresponding_direction, grid2d_direction
- Return type:
Tuple[?, ?]
- to_planeface3d(plane3d: Plane3D | None = None)#
Convert a Bspline face 3d to a Plane face 3d (using or without a reference Plane3D).
- Parameters:
plane3d (Plane3D, optional) – A reference Plane3D, defaults to None
- Returns:
A Plane face 3d.
- Return type:
- triangulation_lines(resolution=25)#
Specify the number of subdivision when using triangulation by lines. (Old triangulation).
- class volmdlr.faces.ConicalFace3D(surface3d: ConicalSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
PeriodicalFaceMixin,Face3DDefines a ConicalFace3D class.
- Parameters:
surface3d (ConicalSurface3D.) – a conical surface 3d.
surface2d (Surface2D.) – a 2d surface to define the conical face.
- circle_inside(circle: Circle3D)#
Verify 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 = '')#
Return the conical face defined by the contour of the base and the cone vertex.
- Parameters:
conical_surface3d – surface 3d.
contour (volmdlr.wires.Contour3D) – Cone, contour base.
name – the name to inject in the new face
- Returns:
Conical face.
- Return type:
- classmethod from_surface_rectangular_cut(conical_surface3d, theta1: float, theta2: float, z1: float, z2: float, name: str = '')#
Cut a rectangular piece of the ConicalSurface3D object and return a ConicalFace3D object.
- neutral_fiber()#
Return the faces’ neutral fiber.
- triangulation_lines(angle_resolution=5)#
Specify the number of subdivision when using triangulation by lines. (Old triangulation).
- class volmdlr.faces.CylindricalFace3D(surface3d: CylindricalSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
PeriodicalFaceMixin,Face3DDefines 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)#
Find out in which direction the faces are adjacent.
- Parameters:
other_face3d (volmdlr.faces.CylindricalFace3D) – The face to evaluation.
- arc_inside(arc: Arc3D)#
Verify if Arc3D is inside a CylindricalFace3D.
- Parameters:
arc – Arc3D to be verified.
- Returns:
True if it is inside, False otherwise.
- arcellipse_inside(arcellipse: ArcEllipse3D)#
Verify if ArcEllipse3D is inside a CylindricalFace3D.
- Parameters:
arcellipse – ArcEllipse3D to be verified.
- Returns:
True if it is inside, False otherwise.
- copy(deep=True, memo=None)#
Return a copy of the CylindricalFace3D.
- face_inside(face2, abs_tol: float = 1e-06)#
Verify if a face is inside another one.
It returns True if face2 is inside or False if the opposite.
- face_tolerance = 0.0001#
- classmethod from_ocp(ocp_face: TopoDS_Shape)#
Translate an occt face into a volmdlr face.
- classmethod from_surface_rectangular_cut(cylindrical_surface, theta1: float, theta2: float, param_z1: float, param_z2: float, name: str = '')#
Cut a rectangular piece of the CylindricalSurface3D object and return a CylindricalFace3D object.
- fullarc_inside(fullarc: FullArc3D)#
Verify if FullArc3D is inside a CylindricalFace3D.
- Parameters:
fullarc – FullArc3D to be verified.
- Returns:
True if it is inside, False otherwise.
- get_geo_lines(tag: int, line_loop_tag: list[int])#
Get the lines that define a CylindricalFace3D in a .geo file.
- min_x_density = 5#
- min_y_density = 1#
- neutral_fiber()#
Return the faces’ neutral fiber.
- parametrized_grid_size(angle_resolution, z_resolution)#
Get 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)#
Find intersections with the given plane face.
- Parameters:
planeface – Plane face to evaluate the intersections.
- triangulation_lines(angle_resolution=5)#
Specify the number of subdivision when using triangulation by lines. (Old triangulation).
- class volmdlr.faces.ExtrusionFace3D(surface3d: ExtrusionSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
Face3DA 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 = '')#
Cut a rectangular piece of the ExtrusionSurface3D object and return a ExtrusionFace3D object.
- min_x_density = 50#
- min_y_density = 1#
- class volmdlr.faces.Face3D(surface3d, surface2d: Surface2D, reference_path: str = '#', name: str = '')#
Bases:
Primitive3DAbstract method to define 3D faces.
- area()#
Compute the area of the surface 2d.
- property bounding_box#
Return the surface bounding box.
- copy(deep=True, memo=None)#
Return a copy of the Face3D.
- divide_face(list_cutting_contours: list[Contour2D], abs_tol: float = 1e-06)#
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)#
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)#
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)#
Return True if edge 3d is coplanar to the face.
- edge_intersections(edge)#
Get the intersections of an edge and a 3D face.
- face_border_intersections(face2)#
Return the intersections of the face outer and inner contour with other given face.
- face_decomposition()#
Decompose the face discretization triangle faces inside eight boxes from a bounding box octree structure.
- face_inside(face2, abs_tol: float = 1e-06)#
Verify if a face is inside another one.
It returns True if face2 is inside or False if the opposite.
- face_intersections_outer_contour(face2)#
Return the intersections of the face outer contour with other given face.
- face_minimum_distance(other_face, return_points: bool = False)#
Get 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)#
Change frame_mapping and return a new Face3D.
side = ‘old’ or ‘new’
- classmethod from_contours3d(surface, contours3d: list[Contour3D], name: str = '', tol: float = 5e-05)#
Return 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.
tol – tolerance.
- static from_contours3d_with_inner_contours(surface, contours3d, abs_tol: float = 1e-06)#
Helper function to class.
- classmethod from_ocp(ocp_face: TopoDS_Shape)#
Translate an occt face into a volmdlr face.
- classmethod from_step(arguments, object_dict, **kwargs)#
Convert 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]#
Get intersections between a face 3d and a Full Arc 3D.
- Parameters:
fullarc – other fullarc.
- Returns:
a list of intersections.
- geo_lines()#
Get the lines that define a Face3D in a .geo file.
- get_bounding_box()#
General method to get the bounding box of a face 3D.
- get_closed_contour_divided_faces_inner_contours(list_faces, new_contour)#
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)#
Get 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)#
Helper function to polygonize the face boundaries.
- get_face_cutting_contours(dict_intersecting_combinations)#
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)#
Get the intersections between two faces.
- Parameters:
face2 – second face.
- Returns:
intersections.
- get_face_polygons()#
Get face polygons.
- get_geo_lines(tag: int, line_loop_tag: list[int])#
Get 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)#
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_points(grid_size, polygon_data=None)#
Parametric tessellation points.
- grid_size()#
Specify an adapted size of the discretization grid used in face triangulation.
- static helper_repair_inner_contours_periodicity(surface, outer_contour2d, inner_contours2d, primitives_mapping)#
Translate inner contours if it’s not inside the outer contour of the face.
- helper_to_mesh(polygon_data=None) Mesh2D#
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)#
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)#
Verify 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)#
Verify 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)#
Verify if a face 3d is being crossed by a line segment 3d.
- line_intersections(line: Line3D) list[Point3D]#
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]#
Get intersections between a face 3d and a Line Segment 3D.
- Parameters:
linesegment – other linesegment.
abs_tol – tolerance used.
- Returns:
a list of intersections.
- min_x_density = 1#
- min_y_density = 1#
- normal_at_point(point)#
Get Normal vector at a given point on the face.
- Parameters:
point – point on the face.
- Returns:
- plane_intersections(plane3d: Plane3D)#
Get 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]
- plot(ax=None, color='k', alpha=1, edge_details=False)#
Plot the face.
- plot2d(ax=None, color='k', alpha=1)#
Plot 2D of the face using matplotlib.
- point_belongs(point3d: Point3D, tol: float = 1e-06)#
Tells you if a point is on the 3D face and inside its contour.
- point_distance(point, return_other_point: bool = False)#
Calculate 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.
- random_point_inside()#
Get a random point on the face.
- rotation(center: Point3D, axis: Vector3D, angle: float)#
Face3D rotation.
- Parameters:
center – rotation center
axis – rotation axis
angle – angle rotation
- Returns:
a new rotated Face3D
- select_face_intersecting_primitives(dict_intersecting_combinations)#
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)#
Get 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)#
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:
- to_dict(*args, **kwargs)#
Avoids storing points in memo that makes serialization slow.
- to_geo(file_name: str)#
Get the .geo file for the Face3D.
- to_ocp()#
Return an OCP shape equivalent to the volmdlr object.
- to_ocp_from_2d()#
Return an OCP shape equivalent to the volmdlr object using Surface2D data.
- to_ocp_from_3d()#
Return an OCP shape equivalent to the volmdlr object using 3D data.
- to_step(current_id)#
Transform a Face 3D into a Step object.
- translation(offset: Vector3D)#
Face3D translation.
- Parameters:
offset (volmdlr.Vector3D) – Translation vector.
- Returns:
A new translated Face3D
- triangulation()#
Triangulates the face.
- triangulation_lines()#
Specify the number of subdivision when using triangulation by lines. (Old triangulation).
- property wrapped#
Get the corresponding ocp face and stores it in a cache variable.
- class volmdlr.faces.PeriodicalFaceMixin#
Bases:
objectAbstract class for mutualizing methods for faces constructed on periodic surfaces.
- face_inside(face2, abs_tol: float = 1e-06)#
Verify if a face is inside another one.
It returns True if face2 is inside or False if the opposite.
- class volmdlr.faces.PlaneFace3D(surface3d: Plane3D, surface2d: Surface2D, reference_path: str = '#', name: str = '')#
Bases:
Face3DDefines a PlaneFace3D class.
- Parameters:
surface3d (Plane3D.) – a plane 3d.
surface2d (Surface2D.) – a 2d surface to define the plane face.
- add_fillets(vertices: list[Point3D], radius: float)#
Add fillets to given vertices of the face.
- Parameters:
vertices – faces vertices where to add a fillet.
radius – fillet radius.
- check_inner_contours(face)#
Check face inner contours.
- circle_inside(circle: Circle3D)#
Verify 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)#
Calculate 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.
- copy(deep=True, memo=None)#
Return a copy of the PlaneFace3D.
- cut_by_coincident_face(face)#
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)#
Calculate 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)#
Evaluate the distance to a given point.
distance_to_point is deprecated, please use point_distance.
- classmethod from_ocp(ocp_face: TopoDS_Shape)#
Translate an occt face into a volmdlr face.
- classmethod from_surface_rectangular_cut(plane3d, x1: float, x2: float, y1: float, y2: float, name: str = '')#
Cut a rectangular piece of the Plane3D object and return a PlaneFace3D object.
- get_geo_lines(tag: int, line_loop_tag: list[int])#
Get the lines that define a PlaneFace3D in a .geo file.
- is_adjacent(face2: Face3D)#
Verify if two plane faces are adjacent to each other.
- Parameters:
face2 – other face.
- Returns:
True if adjacent, False otherwise.
- linesegment_inside(linesegment: LineSegment3D)#
Verify 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])#
Merge 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)#
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)#
Calculate 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)#
Get 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)#
Calculate 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)#
Divide self based on the faces outer, and inner contours.
- Parameters:
faces (TYPE) – DESCRIPTION
- Returns:
DESCRIPTION
- Return type:
TYPE
- toroidalface_intersections(toroidal_face)#
Calculate 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.
- triangle_intersections(triangleface)#
Get the intersections between a Plane Face3D and a Triangle3D.
- Parameters:
triangleface – the other triangle face.
- Returns:
- static update_faces_with_divided_faces(divided_faces, face2_2, used, list_faces)#
Update divided faces from project_faces.
- class volmdlr.faces.RevolutionFace3D(surface3d: RevolutionSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
Face3DA 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 = '')#
Cut a rectangular piece of the RevolutionSurface3D object and return a RevolutionFace3D object.
- get_face_polygons()#
Get face polygons.
- grid_points(grid_size, polygon_data=None)#
Parametric tessellation points.
- grid_size()#
Specify an adapted size of the discretization grid used in face triangulation.
- min_x_density = 50#
- min_y_density = 1#
- triangulation()#
Triangulates the face.
- class volmdlr.faces.RuledFace3D(surface3d: RuledSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
Face3DA 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 = '')#
Cut a rectangular piece of the RuledSurface3D object and return a RuledFace3D object.
- get_bounding_box()#
General method to get the bounding box.
To be enhanced by restricting wires to cut
- grid_size()#
Specify an adapted size of the discretization grid used in face triangulation.
- min_x_density = 50#
- min_y_density = 1#
- triangulation_lines(angle_resolution=10)#
SpecifY the number of subdivision when using triangulation by lines. (Old triangulation).
- class volmdlr.faces.SphericalFace3D(surface3d: SphericalSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
PeriodicalFaceMixin,Face3DDefines 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 = '')#
Face defined by contours and a point indicating the portion of the parametric domain that should be considered.
- Parameters:
surface3d – surface 3d.
contours (list[volmdlr.wires.Contour3D]) – Cone, contour base.
name – the name to inject in the new face
- Returns:
Spherical face.
- Return type:
- classmethod from_ocp(ocp_face: TopoDS_Shape)#
Translate an occt face into a volmdlr face.
- classmethod from_surface_rectangular_cut(spherical_surface, theta1: float = 0.0, theta2: float = 6.283185307179586, phi1: float = -1.5707963267948966, phi2: float = 1.5707963267948966, name='')#
Cut a rectangular piece of the SphericalSurface3D object and return a SphericalFace3D object.
- get_bounding_box()#
Calculate the bounding box of a spherical face.
- Returns:
Bounding Box.
- grid_points(grid_size, polygon_data=None)#
Parametric tessellation points.
- grid_size()#
Specify 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#
- triangulation_lines(angle_resolution=7)#
Specify the number of subdivision when using triangulation by lines. (Old triangulation).
- class volmdlr.faces.ToroidalFace3D(surface3d: ToroidalSurface3D, surface2d: Surface2D, name: str = '')#
Bases:
PeriodicalFaceMixin,Face3DDefines 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
- copy(deep=True, memo=None)#
Return a copy of the ToroidalFace3D.
- face_inside(face2, abs_tol: float = 1e-06)#
Verify if a face is inside another one.
It returns True if face2 is inside or False if the opposite.
- face_tolerance = 0.001#
- classmethod from_ocp(ocp_face: TopoDS_Shape)#
Translate an occt face into a volmdlr face.
- 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 = '')#
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()#
Specify an adapted size of the discretization grid used in face triangulation.
- min_x_density = 5#
- min_y_density = 1#
- neutral_fiber()#
Return the faces’ neutral fiber.
- planeface_intersections(planeface: PlaneFace3D)#
Get intersections between a Toroidal Face 3D and a Plane Face 3D.
- Parameters:
planeface – other plane face.
- Returns:
intersections.
- static points_resolution(line, pos, resolution)#
Legacy?.
- triangulation_lines(angle_resolution=5)#
Specify the number of subdivision when using triangulation by lines. (Old triangulation).
- class volmdlr.faces.Triangle3D(point1: Point3D, point2: Point3D, point3: Point3D, alpha=1, color=None, name: str = '')#
Bases:
PlaneFace3DDefines a Triangle3D class.
- Parameters:
point1 (volmdlr.Point3D.) – The first point.
point2 (volmdlr.Point3D.) – The second point.
point3 (volmdlr.Point3D.) – The third point.
- area() float#
Calculate the area for the Triangle3D.
- Returns:
area triangle.
- Return type:
float.
Formula explained here: https://www.triangle-calculator.com/?what=vc
- copy(deep=True, memo=None)#
Return a copy of the Triangle3D.
- classmethod dict_to_object(dict_, *args, **kwargs)#
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)#
Change frame_mapping and return a new Triangle3D.
- Parameters:
frame – frame used.
side – ‘old’ or ‘new’.
- get_bounding_box()#
General method to get the bounding box.
- static get_subdescription_points(new_points, resolution, max_length)#
Get sub-description points.
- height()#
Get Triangle height.
- middle()#
Get the middle point of the face: center of gravity.
- rotation(center: Point3D, axis: Vector3D, angle: float)#
Triangle3D rotation.
- Parameters:
center – rotation center.
axis – rotation axis.
angle – angle rotation.
- Returns:
a new rotated Triangle3D.
- subdescription(resolution=0.01)#
Return a list of Point3D with resolution as max between Point3D.
- subdescription_to_triangles(resolution=0.01)#
Return a list of Triangle3D with resolution as max length of sub triangles side.
- property surface2d#
Boundary representation of the face.
- property surface3d#
Get the plane on which the triangle is contained.
- to_dict(*args, **kwargs)#
Create a Dictionary with the object’s instance attributes.
- translation(offset: Vector3D)#
Plane3D translation.
- Parameters:
offset – translation vector.
- Returns:
A new translated Plane3D.
- triangle_minimum_distance(triangle_face, return_points=False)#
Get the minimum distance between two triangle.
- triangulation()#
Compute the triangulation of the Triangle3D, basically returns itself.
- volmdlr.faces.octree_decomposition(bbox, faces)#
Decomposes a list of faces into eight Bounding boxes subdivided boxes.
- volmdlr.faces.octree_face_decomposition(face)#
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.
- volmdlr.faces.parametric_face_inside(face1, face2, abs_tol: float = 1e-06)#
Verify if a face2 is inside face1.
It returns True if face2 is inside or False if the opposite.