Edges#

Edges related classes.

class volmdlr.edges.Arc2D(circle: Circle2D, start: Point2D, end: Point2D, reference_path: str = '#', name: str = '')[source]#

Bases: ArcMixin, Edge

Class to draw Arc2D.

angle: the angle measure always >= 0

abscissa(point: Point2D, tol=1e-06)[source]#

Returns the abscissa of a given point 2d.

property angle#

Arc angle property.

Returns:

arc angle.

arc_intersections(arc, abs_tol: float = 1e-06)[source]#

Intersections between two arc 2d.

arcellipse_intersections(arcellipse, abs_tol: float = 1e-06)[source]#

Intersections between an arc 2d and arc-ellipse 2d.

Parameters:
  • arcellipse – arc-ellipse 2d.

  • abs_tol – tolerance

Returns:

list of intersection points.

area()[source]#

Calculates the area of the Arc2D.

Returns:

the area of the Arc2D.

axial_symmetry(line)[source]#

Finds out the symmetric arc 2D according to a line.

property bounding_rectangle#

Gets the bounding rectangle for an Arc 2D.

bsplinecurve_intersections(bspline, abs_tol: float = 1e-06)[source]#

Intersections between an arc 2d and bspline curve 2d.

Parameters:
  • bspline – bspline curve 2d.

  • abs_tol – tolerance.

Returns:

list of intersection points.

center_of_mass()[source]#

Calculates the center of mass of the Arc2D.

Returns:

center of mass point.

complementary()[source]#

Gets the complementary Arc 2D.

copy(*args, **kwargs)[source]#

Creates and returns a deep copy of the Arc2D object.

Parameters:
  • *args

    Variable-length argument list.

  • **kwargs

    Arbitrary keyword arguments.

Returns:

A new Arc2D object that is a deep copy of the original.

frame_mapping(frame: Frame2D, side: str)[source]#

Changes vector frame_mapping and return a new Arc2D.

side = ‘old’ or ‘new’

classmethod from_3_points(point1, point2, point3, reference_path: str = '#', name: str = '')[source]#

Creates a circle 2d from 3 points.

Returns:

circle 2d.

get_start_end_angles()[source]#

Returns the start and end angle of the arc.

infinite_primitive(offset)[source]#

Create an offset curve from a distance of the original curve.

property is_trigo#

Return True if circle is counterclockwise.

line_intersections(line2d: Line2D)[source]#

Calculates the intersection between a line and an Arc2D.

Parameters:

line2d – Line2D to verify intersections.

Returns:

a list with intersections points.

linesegment_intersections(linesegment2d: LineSegment2D, abs_tol=1e-06)[source]#

Calculates the intersection between a LineSegment2D and an Arc2D.

Parameters:
  • linesegment2d – LineSegment2D to verify intersections.

  • abs_tol – tolerance.

Returns:

a list with intersections points.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plot arc 2d with Matplotlib.

plot_data(edge_style: EdgeStyle | None = None)[source]#

Plot data method for a Arc2D.

Parameters:

edge_style (plot_data.EdgeStyle) – edge style.

Returns:

plot_data.Arc2D object.

point_belongs(point, abs_tol=1e-06)[source]#

Check if a Point2D belongs to the Arc2D.

property points#
rotation(center: Point2D, angle: float)[source]#

Arc2D rotation.

Parameters:
  • center – rotation center

  • angle – angle rotation.

Returns:

a new rotated Arc2D.

second_moment_area(point)[source]#

Second moment area of part of disk.

straight_line_area()[source]#

Calculates the area of the arc 2D, with line drawn from start to end.

Returns:

straight_line_area.

straight_line_center_of_mass()[source]#

Straight line center of mass.

straight_line_point_belongs(point)[source]#

Verifies if a point belongs to the surface created by closing the edge.

Parameters:

point – Point to be verified.

Returns:

Return True if the point belongs to this surface, or False otherwise.

straight_line_second_moment_area(point: Point2D)[source]#

Straight line second moment area for an Arc 2D.

to_3d(plane_origin, x, y)[source]#

Transforms the arc 2D into a 3D arc.

Parameters:
  • plane_origin (volmdlr.Point3D) – The origin of plane to draw the arc 3D.

  • x (volmdlr.Vector3D) – First direction of the plane

  • y (volmdlr.Vector3D) – Second direction of the plane.

Returns:

A 3D arc.

Type:

Arc3D.

to_dict(use_pointers: bool = False, memo=None, path: str = '#', id_method=True, id_memo=None, **kwargs)[source]#

Stores all Arc 2D attributes in a dict object.

to_full_arc_2d()[source]#

Convert to a full arc2d.

translation(offset: Vector2D)[source]#

Arc2D translation.

Parameters:

offset – translation vector.

Returns:

A new translated Arc2D.

class volmdlr.edges.Arc3D(circle, start, end, name='')[source]#

Bases: ArcMixin, Edge

An arc is defined by a starting point, an end point and an interior point.

abscissa(point: Point3D, tol: float = 1e-06)[source]#

Calculates the abscissa given a point in the Arc3D.

Parameters:
  • point – point to calculate the abscissa.

  • tol – (Optional) Confusion distance to consider points equal. Default 1e-6.

Returns:

corresponding abscissa.

arc_intersections(other_arc, abs_tol: 1e-06)[source]#

Calculates intersections between two Arc3D.

Parameters:
  • other_arc – Arc 3D to verify intersections.

  • abs_tol – tolerance.

Returns:

list with intersections points between the two Arc3D.

arcellipse_intersections(arcellipse3d, abs_tol: float = 1e-06)[source]#

Calculates intersections between two Arc3D.

Parameters:
  • arcellipse3d – ArcEllipse 3D to verify intersections.

  • abs_tol – Tolerance.

Returns:

List with intersections points between ArcEllipse3D and Arc3D.

property bounding_box#

Bounding box for Arc 3D.

complementary()[source]#

Creates the corresponding complementary arc.

copy(*args, **kwargs)[source]#

Create a Copy of an Arc 3D.

direction_vector(abscissa)[source]#

Calculates a direction vector at a given abscissa of the Arc3D.

Parameters:

abscissa – abscissa where in the curve the direction vector should be calculated.

Returns:

Corresponding direction vector.

distance_arc(arc3d, return_points=False)[source]#

Gets the minimum distance between two Arcs 3D.

Parameters:
  • arc3d – other arc 3d.

  • return_points – boolean to decide weather to return the corresponding minimal distance points or not.

Returns:

minimum distance / minimal distance with corresponding points.

distance_linesegment(linesegment3d, return_points=False)[source]#

Gets the minimum distance between an Arc 3D and Line Segment 3D.

Parameters:
  • linesegment3d – other line segment 3d.

  • return_points – boolean to decide weather to return the corresponding minimal distance points or not.

Returns:

minimum distance / minimal distance with corresponding points.

extrusion(extrusion_vector)[source]#

Extrudes an arc 3d in the given extrusion vector direction.

frame_mapping(frame: Frame3D, side: str)[source]#

Changes vector frame_mapping and return a new Arc3D.

side = ‘old’ or ‘new’

classmethod from_3_points(point1, point2, point3, name: str = '')[source]#

Creates an Arc 3d using three points.

Parameters:
  • point1 – start point.

  • point2 – interior point.

  • point3 – end point.

  • name – object’s name.

Returns:

Arc 3D.

classmethod from_angle(start: Point3D, angle: float, axis_point: Point3D, axis: Vector3D, name: str = '')[source]#

Gives the arc3D from a start, an angle and an axis.

get_bounding_box()[source]#

Calculates the bounding box of the Arc3D.

Returns:

Bounding Box object.

get_reverse()[source]#

Defines a new Arc3D, identical to self, but in the opposite direction.

property is_trigo#

Return True if circle is counterclockwise.

line_intersections(line3d: Line3D, tol: float = 1e-06)[source]#

Calculates intersections between an Arc3D and a Line3D.

Parameters:
  • line3d – line to verify intersections.

  • tol – maximum tolerance.

Returns:

list with intersections points between line and Arc3D.

linesegment_intersections(linesegment3d: LineSegment3D, abs_tol: float = 1e-06)[source]#

Calculates intersections between an Arc3D and a LineSegment3D.

Parameters:
  • linesegment3d – linesegment to verify intersections.

  • abs_tol – tolerance to be considered while validating an intersection.

Returns:

list with intersections points between linesegment and Arc3D.

minimum_distance_points_arc(other_arc)[source]#

Calculates the minimum distance points between two arcs.

move_frame_along(frame)[source]#

Move frame along edge.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plot method for Arc 3D using Matplotlib.

plot2d(center: Point3D = Point3D(0.0, 0.0, 0.0), x3d: Vector3D = Vector3D(1.0, 0.0, 0.0), y3d: Vector3D = Vector3D(0.0, 1.0, 0.0), ax=None, color='k')[source]#

Plot data.

point_at_abscissa(abscissa)[source]#

Calculates a point in the Arc3D at a given abscissa.

Parameters:

abscissa – abscissa where in the curve the point should be calculated.

Returns:

Corresponding point.

point_belongs(point, abs_tol: float = 1e-06)[source]#

Check if a point 3d belongs to the arc_3d or not.

Parameters:
  • point – point to be verified is on arc.

  • abs_tol – tolerance allowed.

Returns:

True if point is on Arc, False otherwise.

property points#

Gets arc points.

Returns:

list with arc points.

revolution(axis_point: Point3D, axis: Vector3D, angle: float)[source]#

Revolution of Arc 3D around an axis.

Parameters:
  • axis_point – revolution axis point.

  • axis – revolution axis.

  • angle – revolution angle.

rotation(center: Point3D, axis: Vector3D, angle: float)[source]#

Arc3D rotation.

Parameters:
  • center – rotation center

  • axis – rotation axis

  • angle – angle rotation

Returns:

a new rotated Arc3D

sweep(*args, **kwargs)[source]#

Arc 3D is used as path for sweeping given section through it.

Returns:

to_2d(plane_origin, x, y)[source]#

Transforms a Arc3D into an Arc2D, given a plane origin and an u and v plane vector.

Parameters:
  • plane_origin – plane origin.

  • x – plane u vector.

  • y – plane v vector.

Returns:

Arc2D.

to_dict(use_pointers: bool = False, memo=None, path: str = '#', id_method=True, id_memo=None)[source]#

Saves the object parameters into a dictionary.

translation(offset: Vector3D)[source]#

Arc3D translation.

Parameters:

offset – translation vector.

Returns:

A new translated Arc3D.

triangulation()[source]#

Triangulation for an Arc3D.

class volmdlr.edges.ArcEllipse2D(ellipse: Ellipse2D, start: Point2D, end: Point2D, name: str = '')[source]#

Bases: ArcEllipseMixin, Edge

An 2-dimensional elliptical arc.

Parameters:
  • ellipse (volmdlr.curves.Ellipse2D.) – An ellipse curve, as base for the arc ellipse.

  • start (volmdlr.Point2D) – The starting point of the elliptical arc

  • end (volmdlr.Point2D) – The end point of the elliptical arc

  • name (str, optional) – The name of the elliptical arc. Default value is ‘’

abscissa(point: Point2D, tol: float = 1e-06)[source]#

Calculates the abscissa of a given point.

Parameters:
  • point – point for calculating abscissa

  • tol – tolerance.

Returns:

a float, between 0 and the arc ellipse 2d’s length

property angle#

Gets arc of ellipse angle.

property angle_end#

Gets arc of ellipse ending angle.

property angle_start#

Gets arc of ellipse starting angle.

property bounding_rectangle#

Calculates the bounding rectangle for the arc ellipse 2d.

Returns:

Bounding Rectangle object.

bsplinecurve_intersections(bspline, abs_tol: float = 1e-06)[source]#

Intersections between an Arc Ellipse 2D and a bSpline 2D.

Parameters:
  • bspline – bspline 2D to verify intersections.

  • abs_tol – tolerance.

Returns:

List with all intersections.

property center#

Gets ellipse’s center point.

complementary()[source]#

Gets the complementary arc of ellipse.

direction_vector(abscissa)[source]#

Calculates the tangent vector to an ellipse at a given abscissa.

Parameters:

abscissa (float.) – The abscissa value at which the tangent vector is to be calculated.

Returns:

The tangent vector to the ellipse at the given abscissa.

Return type:

volmdlr.Vector2D.

Raises:

ValueError If the abscissa is out of range.

discretization_points(*, number_points: int | None = None, angle_resolution: int | None = None)[source]#

Discretization of an Edge to have “n” points.

Parameters:
  • number_points – the number of points (including start and end points) if unset, only start and end will be returned.

  • angle_resolution – if set, the sampling will be adapted to have a controlled angular distance. Useful to mesh an arc.

Returns:

a list of sampled points.

frame_mapping(frame: Frame2D, side: str)[source]#

Changes frame_mapping and return a new Arc Ellipse 2D.

side = ‘old’ or ‘new’

classmethod from_3_points_and_center(start, interior, end, center, name: str = '')[source]#

Creates an arc ellipse using 3 points and a center.

Parameters:
  • start – start point.

  • interior – interior point.

  • end – end point.

  • center – ellipse’s point.

  • name – object’s name.

Returns:

An arc-ellipse2D object.

get_end_angle()[source]#

Gets angle for the end point.

get_reverse()[source]#

Gets the arc ellipse in the reverse direction.

get_start_angle()[source]#

Gets angle for the start point.

is_close(other_edge, tol: float = 1e-06)[source]#

Checks if two arc-ellipse are the same considering the Euclidean distance.

Parameters:
  • other_edge – other arc-ellipse.

  • tol (float, optional) – The tolerance under which the Euclidean distance is considered equal to 0, defaults to 1e-6.

length()[source]#

Calculates the length of the arc-ellipse 2d.

Returns:

arc ellipse 2d’s length

line_intersections(line2d: Line2D, tol: float = 1e-06)[source]#

Intersections between an Arc Ellipse 2D and a Line 2D.

Parameters:
  • line2d – Line 2D to verify intersections

  • tol – maximum tolerance.

Returns:

List with all intersections

linesegment_intersections(linesegment2d: LineSegment2D, abs_tol=1e-06)[source]#

Intersections between an Arc Ellipse 2D and a Line Segment 2D.

Parameters:
  • linesegment2d – LineSegment 2D to verify intersections.

  • abs_tol – tolerance.

Returns:

List with all intersections.

normal_vector(abscissa)[source]#

Calculates the normal vector to an ellipse at a given abscissa.

Parameters:

abscissa (float.) – The abscissa value at which the normal vector is to be calculated.

Returns:

The normal vector to the ellipse at the given abscissa.

Return type:

volmdlr.Vector2D.

Raises:

ValueError If the abscissa is out of range.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plot arc-ellipse 2d using Matplotlib.

Parameters:
  • ax – Matplotlib plot if there exists any.

  • edge_style – edge styles.

Returns:

Matplotlib plot

point_at_abscissa(abscissa)[source]#

Get a point at given abscissa.

point_belongs(point, abs_tol: float = 1e-06)[source]#

Verifies if a point belongs to the arc ellipse 2d.

Parameters:
  • point – point to be verified

  • abs_tol – tolerance applied during calculations

Returns:

True if the point belongs, False otherwise

property points#
rotation(center, angle: float)[source]#

Rotation of ellipse around a center and an angle.

Parameters:
  • center – center of the rotation.

  • angle – angle to rotated of.

Returns:

a rotated new ellipse.

split(split_point, tol: float = 1e-06)[source]#

Splits arc-ellipse at a given point.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list of two Arc-Ellipse.

straight_line_area()[source]#

Calculates the area of the elliptic arc, with line drawn from start to end.

Returns:

straight_line_area.

straight_line_center_of_mass()[source]#

Straight line center of mass.

PS.: This is an approximation.

straight_line_point_belongs(point)[source]#

Verifies if a point belongs to the surface created by closing the edge.

Parameters:

point – Point to be verified

Returns:

Return True if the point belongs to this surface, or False otherwise

to_3d(plane_origin, x, y)[source]#

Transforms the arc of ellipse 2D into a 3D arc of ellipse.

Parameters:
  • plane_origin (volmdlr.Point3D) – The origin of plane to draw the arc of ellipse 3D.

  • x (volmdlr.Vector3D) – First direction of the plane

  • y (volmdlr.Vector3D) – Second direction of the plane.

Returns:

A 3D arc of ellipse.

Type:

ArcEllipse3D.

translation(offset: Vector2D)[source]#

Translates the Arc ellipse given an offset vector.

Parameters:

offset – offset vector

Returns:

new translated arc ellipse 2d.

valid_abscissa_start_end_angle(angle_abscissa)[source]#

Get valid abscissa angle for start and end.

class volmdlr.edges.ArcEllipse3D(ellipse: Ellipse3D, start: Point3D, end: Point3D, name='')[source]#

Bases: ArcEllipseMixin, Edge

An arc is defined by a starting point, an end point and an interior point.

abscissa(point: Point3D, tol: float = 1e-06)[source]#

Calculates the abscissa a given point.

Parameters:
  • point – point to calculate abscissa.

  • tol – tolerance allowed.

Returns:

abscissa

arcellipse_intersections(arcellipse3d, abs_tol: float = 1e-06)[source]#

Gets the intersections between an Ellipse 3D and a Line Segment 3D.

Parameters:
  • arcellipse3d – The other linesegment.

  • abs_tol – The absolute tolerance.

Returns:

A list with the intersections points between the two edges.

property bounding_box#

Getter Bounding Box for an arc ellipse 3d.

Returns:

bounding box.

property center#

Gets ellipse’s center point.

complementary()[source]#

Gets the complementary arc of ellipse.

direction_vector(abscissa)[source]#

Returns the tangent vector at a given abscissa along the ArcEllipse3D.

This method calculates and returns the tangent vector at a specific abscissa along the ArcEllipse3D, which represents the direction of the curve at that point.

Parameters:

abscissa (float) – The parameter value (abscissa) along the curve.

Returns:

Vector3D A Vector3D object representing the tangent vector at the given abscissa.

Raises:
  • ValueError: If the abscissa is out of the valid range of the curve.

discretization_points(*, number_points: int | None = None, angle_resolution: int = 20)[source]#

Discretization of a Contour to have “n” points.

Parameters:
  • number_points – the number of points (including start and end points) if unset, only start and end will be returned

  • angle_resolution – if set, the sampling will be adapted to have a controlled angular distance. Useful to mesh an arc

Returns:

a list of sampled points

frame_mapping(frame: Frame3D, side: str)[source]#

Changes frame_mapping and return a new ArcEllipse3D.

Parameters:
  • frame (volmdlr.Frame3D) – Local coordinate system.

  • side (str) – ‘old’ will perform a transformation from local to global coordinates. ‘new’ will perform a transformation from global to local coordinates.

Returns:

A new transformed ArcEllipse3D.

Return type:

ArcEllipse3D

get_bounding_box()[source]#

Calculates the bounding box of the Arc3D.

Returns:

Bounding Box object.

get_reverse()[source]#

Gets the same ellipse but in the reverse direction.

get_start_end_angles()[source]#

Calculate the start and end angles of the ArcEllipse3D in radians.

This method computes the start and end angles of the ArcEllipse3D, which represent the angles, in radians, between the major axis of the ellipse and the start and end points on the ellipse’s boundary.

Returns:

tuple of floats A tuple containing the start and end angles in radians.

is_close(other_arcellipse, abs_tol: float = 1e-06)[source]#

Verifies if two arc ellipses are the same, considereing given tolerance.

Parameters:
  • other_arcellipse – other arc ellipse.

  • abs_tol – tolerance.

Returns:

True or False.

length()[source]#

Computes the length.

line_intersections(line, abs_tol: float = 1e-06)[source]#

Gets the intersections between an Ellipse 3D and a Line 3D.

Parameters:
  • line – The intersecting lines.

  • abs_tol – The absolute tolerance.

Returns:

A list with the intersections points between the two edges.

linesegment_intersections(linesegment, abs_tol: float = 1e-06)[source]#

Gets the intersections between an Ellipse 3D and a Line Segment 3D.

Parameters:
  • linesegment – The other linesegment.

  • abs_tol – The absolute tolerance.

Returns:

A list with the intersections points between the two edges.

property normal#

Gets ellipse’s normal direction.

normal_vector(abscissa)[source]#

Returns the normal vector at a given abscissa.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plot the arc ellipse.

plot2d(x3d: Vector3D = Vector3D(1.0, 0.0, 0.0), y3d: Vector3D = Vector3D(0.0, 1.0, 0.0), ax=None, color='k')[source]#

Plot 2d for an arc ellipse 3d.

point_at_abscissa(abscissa)[source]#

Calculates the point at a given abscissa.

Parameters:

abscissa – abscissa to calculate point.

Returns:

volmdlr.Point3D

point_belongs(point, abs_tol: float = 1e-06)[source]#

Verifies if a given point lies on the arc of ellipse 3D.

Parameters:
  • point – point to be verified.

  • abs_tol – Absolute tolerance to consider the point on the curve.

Returns:

True is point lies on the arc of ellipse, False otherwise

rotation(center: Point3D, axis: Vector3D, angle: float)[source]#

Arc-Ellipse3D rotation.

Parameters:
  • center – rotation center.

  • axis – rotation axis.

  • angle – angle rotation.

Returns:

a new rotated Arc-Ellipse3D.

property self_2d#

Arc ellipse 2d version of self.

split(split_point, tol: float = 1e-06)[source]#

Splits arc-ellipse at a given point.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list of two Arc-Ellipse.

to_2d(plane_origin, x, y)[source]#

Transforms an Arc Ellipse 3D into an Arc Ellipse 2D, given a plane origin and an u and v plane vector.

Parameters:
  • plane_origin – plane origin.

  • x – plane u vector.

  • y – plane v vector.

Returns:

ArcEllipse2D.

translation(offset: Vector3D)[source]#

ArcEllipse3D translation.

Parameters:

offset – translation vector.

Returns:

A new translated ArcEllipse3D.

triangulation()[source]#

Triangulation for an Arc Ellipse 3D.

validate_intersections(intersections: List[Point3D], abs_tol: float = 1e-06)[source]#

Helper function to validate edge intersections.

class volmdlr.edges.ArcEllipseMixin[source]#

Bases: object

Abstract class for ArcEllipses.

get_shared_section(other_arcelipse, abs_tol: float = 1e-06)[source]#

Gets the shared section between two arcs of ellipse.

Parameters:
  • other_arcelipse – other arc ellipse to verify for shared section.

  • abs_tol – tolerance.

Returns:

shared arc section.

class volmdlr.edges.ArcMixin(circle, start, end, name: str = '')[source]#

Bases: object

Abstract class representing an arc.

Parameters:

circle (Union['volmdlr.curves.Circle2D', 'volmdlr.curves.Circle2D'].) – arc related circle curve.

# :param start: The starting point # :type start: Union[volmdlr.Point2D, volmdlr.Point3D] # :param end: The finish point # :type end: Union[volmdlr.Point2D, volmdlr.Point3D] # :param name: The name of the arc. Default value is an empty string # :type name: str, optional

property angle#

Arc angle property.

Returns:

arc angle.

property center#

Gets arc center.

direction_vector(abscissa: float)[source]#

Get direction vector of the Arc2D.

Parameters:

abscissa – defines where in the Arc2D the

direction vector is to be calculated :return: The direction vector of the Arc2D

discretization_points(*, number_points: int | None = None, angle_resolution: int = 20)[source]#

Discretize an Edge to have “n” points.

Parameters:
  • number_points – the number of points (including start and end points) if unset, only start and end will be returned

  • angle_resolution – if set, the sampling will be adapted to have a controlled angular distance. Useful to mesh an arc

Returns:

a list of sampled points

property frame#

Gets the arc frame.

get_arc_point_angle(point)[source]#

Returns the angle of point on a trigonometric arc.

get_geo_lines(tag: int, start_point_tag: int, center_point_tag: int, end_point_tag: int)[source]#

Gets the lines that define an Arc in a .geo file.

Parameters:
  • tag (int) – The linesegment index

  • start_point_tag (int) – The linesegment’ start point index

  • center_point_tag (int) – The linesegment’ center point index

  • end_point_tag (int) – The line segment’s end point index

Returns:

A line

Return type:

str

get_geo_points()[source]#

Gets the points that define an Arc to use them in a .geo file.

Returns:

A list of characteristic arc points

Return type:

List

get_reverse()[source]#

Gets the reverse version of an arc.

Returns:

An arc

get_shared_section(other_arc, abs_tol: float = 1e-06)[source]#

Gets the shared section between two arcs.

Parameters:
  • other_arc – other arc to verify for shared section.

  • abs_tol – tolerance.

Returns:

shared arc section.

get_start_end_angles()[source]#

Returns the start and end angle of the arc.

is_close(other_edge, tol: float = 1e-06)[source]#

Checks if two arc are the same considering the Euclidean distance.

Parameters:
  • other_edge – other arc.

  • tol (float, optional) – The tolerance under which the Euclidean distance is considered equal to 0, defaults to 1e-6

length()[source]#

Calculates the length of the Arc, with its radius, and its arc angle.

Returns:

the length of the Arc.

normal_vector(abscissa: float)[source]#

Get the normal vector of the Arc2D.

Parameters:

abscissa – defines where in the Arc2D the

normal vector is to be calculated :return: The normal vector of the Arc2D

point_at_abscissa(abscissa)[source]#

Calculates a point in the Arc at a given abscissa.

Parameters:

abscissa – abscissa where in the curve the point should be calculated.

Returns:

Corresponding point.

point_distance(point)[source]#

Returns the minimal distance to a point.

property radius#

Gets arc radius.

split(split_point, tol: float = 1e-06)[source]#

Splits arc at a given point.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list of two Arc.

class volmdlr.edges.BSplineCurve(degree: int, control_points: List[Point2D] | List[Point3D] | ndarray[Any, dtype[_ScalarType_co]], knot_multiplicities: List[int] | ndarray[Any, dtype[_ScalarType_co]], knots: List[float] | ndarray[Any, dtype[_ScalarType_co]], weights: List[float] | ndarray[Any, dtype[_ScalarType_co]] | None = None, name: str = '')[source]#

Bases: Edge

An abstract class for B-spline curves.

The following rule must be respected : number of knots = number of control points + degree + 1.

Parameters:
  • degree (int) – The degree of the B-spline curve.

  • control_points (Union[List[volmdlr.Point2D], List[volmdlr.Point3D]]) – A list of 2 or 3-dimensional points

  • knot_multiplicities (List[int]) – The vector of multiplicities for each knot

  • knots (List[float]) – The knot vector composed of values between 0 and 1

  • weights (List[float], optional) – The weight vector applied to the knot vector. Default value is None

  • periodic (bool, optional) – If True the B-spline curve is periodic. Default value is False

  • name (str, optional) – The name of the B-spline curve. Default value is ‘’

abscissa(point: Point2D | Point3D, tol: float = 1e-07)[source]#

Computes the abscissa of a 2D or 3D point using the least square method.

Parameters:
  • point (Union[volmdlr.Point2D, volmdlr.Point3D].) – The point located on the B-spline curve.

  • tol (float, optional.) – The precision in terms of distance. Default value is 1e-6.

Returns:

The abscissa of the point.

Return type:

float

abscissa_to_parameter(abscissa: float)[source]#

Search for the value of the normalized evaluation parameter u.

Returns:

the given point when the BSplineCurve3D is evaluated at the u value.

property control_points#

Return the control points of the bspline curve.

copy(deep: bool = True, **kwargs)[source]#

Returns a copy of the instance.

Parameters:

deep – If False, perform a shallow copy. If True, perform a deep copy.

cut_after(parameter: float)[source]#

Returns the left side of the split curve at a given parameter.

Parameters:

parameter (float) – parameter value that specifies where to split the curve.

cut_before(parameter: float)[source]#

Returns the right side of the split curve at a given parameter.

Parameters:

parameter (float) – parameter value that specifies where to split the curve.

property data#

Returns a dictionary of the BSpline data.

decompose(return_params: bool = False)[source]#

Decomposes the curve into Bézier curve segments of the same degree.

Returns:

a list of Bezier segments

Return type:

list

property delta#

Evaluation delta.

Evaluation delta corresponds to the step size while evaluate function iterates on the knot vector to generate curve points. Decreasing step size results in generation of more curve points. Therefore, smaller the delta value, smoother the curve.

Getter:

Gets the delta value

Setter:

Sets the delta value

Type:

float

derivatives(u, order)[source]#

Evaluates n-th order curve derivatives at the given parameter value.

The output of this method is list of n-th order derivatives. If order is 0, then it will only output the evaluated point. Similarly, if order is 2, then it will output the evaluated point, 1st derivative and the 2nd derivative.

Example:

Assuming a curve self is defined on a parametric domain [0.0, 1.0]. Let’s take the curve derivative at the parametric position u = 0.35.

>>> derivatives = self.derivatives(u=0.35, order=2)
>>> derivatives[0]  # evaluated point, equal to crv.evaluate_single(0.35)
>>> derivatives[1]  # 1st derivative at u = 0.35
>>> derivatives[2]  # 2nd derivative at u = 0.35
Parameters:
  • u (float) – parameter value

  • order (int) – derivative order

Returns:

a list containing up to {order}-th derivative of the curve

Return type:

Union[List[volmdlr.Vector2D], List[volmdlr.Vector3D]]

direction_vector(abscissa)[source]#

Calculates the direction vector on the BSpline curve at given abscissa.

Parameters:

abscissa – edge abscissa

Returns:

direction vector

discretization_points(*, number_points: int | None = None, angle_resolution: int | None = None)[source]#

Linear spaced discretization of the curve.

Parameters:
  • number_points (int) – The number of points to include in the discretization.

  • angle_resolution (int) – The resolution of the angle to use when calculating the number of points.

Returns:

A list of discretized points on the B-spline curve.

Return type:

List[`volmdlr.Point2D] or List[`volmdlr.Point3D]

property domain#

Domain.

Domain is determined using the knot vector(s).

Getter:

Gets the domain

evaluate(**kwargs)[source]#

Evaluates the curve.

The evaluated points are stored in evalpts property.

Keyword Arguments:

  • start: start parameter

  • stop: stop parameter

The start and stop parameters allow evaluation of a curve segment in the range [start, stop], i.e. the curve will also be evaluated at the stop parameter value.

The following examples illustrate the usage of the keyword arguments.

evaluate_single(u)[source]#

Calculates a point in the BSplineCurve at a given parameter u.

Parameters:

u (float) – Curve parameter. Must be a value between 0 and 1.

Returns:

Corresponding point.

Return type:

Union[volmdlr.Point2D, Union[volmdlr.Point3D]

frame_mapping(frame: Frame3D | Frame2D, side: str)[source]#

Returns a new Revolution Surface positioned in the specified frame.

Parameters:
  • frame (volmdlr.Frame3D) – Frame of reference

  • side – ‘old’ or ‘new’

classmethod from_bsplines(bsplines: List[BSplineCurve], discretization_points: int = 10, name: str = '')[source]#

Creates a B-spline curve from a list of B-spline curves.

Parameters:
  • bsplines (List[volmdlr.edges.BSplineCurve]) – A list of B-spline curve

  • discretization_points (int, optional.) – The number of points for the discretization. Default value is 10

  • name – object’s name.

Returns:

A merged B-spline curve

Return type:

volmdlr.edges.BSplineCurve

classmethod from_geomdl_curve(curve, name: str = '')[source]#

# TODO: to be completed.

Parameters:
  • curve

  • name – curve name.

Returns:

A reversed B-spline curve

Return type:

volmdlr.edges.BSplineCurve

classmethod from_points_approximation(points: List[Point2D] | List[Point3D], degree: int, name: str = '', **kwargs)[source]#

Creates a B-spline curve approximation using least squares method with fixed number of control points.

It is recommended to specify the number of control points. Please refer to The NURBS Book (2nd Edition), pp.410-413 for details.

Parameters:
  • points (Union[List[volmdlr.Point2D], List[volmdlr.Point3D]]) – The data points

  • degree (int) – The degree of the output parametric curve

  • name – (optional) Curve name.

  • kwargs – See below

  • centripetal – Activates centripetal parametrization method. Default value is False

  • ctrlpts_size – Number of control points. Default value is len(points) - 1

Returns:

A B-spline curve from points approximation

Return type:

volmdlr.edges.BSplineCurve

classmethod from_points_interpolation(points: List[Point2D] | List[Point3D], degree: int, centripetal: bool = True, name: str = ' ')[source]#

Creates a B-spline curve interpolation through the data points.

Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.

Parameters:
  • points (Union[List[volmdlr.Point2D], List[volmdlr.Point3D]]) – The data points

  • degree (int) – The degree of the output parametric curve

  • centripetal – Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition),

pp.369-370 for details. :type centripetal: bool :param name: curve name. :return: A B-spline curve from points interpolation :rtype: volmdlr.edges.BSplineCurve

get_abscissa_discretization(abscissa1, abscissa2, number_points: int = 10, return_abscissas: bool = False)[source]#

Gets n discretization points between two given points of the edge.

Parameters:
  • abscissa1 – Starting abscissa.

  • abscissa2 – Ending abscissa edge.

  • number_points – number of points to discretize locally.

  • return_abscissas – If True, returns the list of abscissas of the discretization points.

Returns:

list of locally discretized points.

get_bounding_element()[source]#

Gets bounding box if a 3D object, or bounding rectangle if 2D.

get_geo_lines(tag: int, control_points_tags: List[int])[source]#

Gets the lines that define a BsplineCurve in a .geo file.

Parameters:

tag (int) – The BsplineCurve index

Returns:

A line

Return type:

str

get_geo_points()[source]#

Gets the points that define a BsplineCurve in a .geo file.

get_linesegment_intersections(linesegment)[source]#

Calculates intersections between a BSplineCurve and a LineSegment.

Parameters:

linesegment – linesegment to verify intersections.

Returns:

list with the intersections points.

get_reverse()[source]#

Reverses the BSpline’s direction by reversing its control points.

Returns:

A reversed B-Spline curve.

Return type:

volmdlr.edges.BSplineCurve.

get_shared_section(other_bspline2, abs_tol: float = 1e-06)[source]#

Gets the shared section between two BSpline curves.

Parameters:
  • other_bspline2 – other arc to verify for shared section.

  • abs_tol – tolerance.

Returns:

shared arc section.

is_close(other_edge, tol: float = 1e-06)[source]#

Checks if two bsplines are the same considering the Euclidean distance.

Parameters:
  • other_edge – other bspline.

  • tol (float, optional) – The tolerance under which the Euclidean distance is considered equal to 0, defaults to 1e-6.

is_shared_section_possible(other_bspline2, tol)[source]#

Verifies if it there is any possibility of the two bsplines share a section.

Parameters:
  • other_bspline2 – other bspline.

  • tol – tolerance used.

Returns:

True or False.

property knotvector#

Return the knot vector.

length()[source]#

Returns the length of the B-spline curve.

Returns:

The length of the B-spline curve.

Return type:

float

line_intersections(line, tol: float = 1e-06)[source]#

Calculates the intersections of a BSplineCurve (2D or 3D) with a Line (2D or 3D).

Parameters:
  • line – line to verify intersections

  • tol – tolerance.

Returns:

list of intersections

local_discretization(point1, point2, number_points: int = 10)[source]#

Gets n discretization points between two given points of the edge.

Parameters:
  • point1 – point 1 on edge.

  • point2 – point 2 on edge.

  • number_points – number of points to discretize locally.

Returns:

list of locally discretized points.

Gets local intersections, between a BSpline and an infinite line.

Parameters:
  • line – other line.

  • point1 – local point 1.

  • point2 – local point 2.

  • abs_tol – tolerance.

Returns:

distance to edge.

merge_with(bspline_curve: BSplineCurve)[source]#

Merges consecutive B-spline curves to define a new merged one.

Parameters:

bspline_curve (volmdlr.edges.BSplineCurve) – Another B-spline curve

Returns:

A merged B-spline curve

Return type:

volmdlr.edges.BSplineCurve

merge_with_curves(curves: List[BSplineCurve])[source]#

Merges consecutive B-spline curves to define a new merged one.

Parameters:

curves (List[volmdlr.edges.BSplineCurve]) – A list of B-spline curves

Returns:

A merged B-spline curve

Return type:

volmdlr.edges.BSplineCurve

normal_vector(abscissa)[source]#

Calculates the normal vector to the BSpline curve at given abscissa.

Returns:

the normal vector

property periodic#

Return True if the BSpline is periodic.

point_at_abscissa(abscissa)[source]#

Calculates a point in the BSplineCurve at a given abscissa.

Parameters:

abscissa – abscissa where in the curve the point should be calculated.

Returns:

Corresponding point.

point_belongs(point: Point2D | Point3D, abs_tol: float = 1e-06)[source]#

Checks if a 2D or 3D point belongs to the B-spline curve or not. It uses the point_distance.

Parameters:
  • point (Union[volmdlr.Point2D, volmdlr.Point3D]) – The point to be checked.

  • abs_tol (float, optional.) – The precision in terms of distance. Default value is 1e-6

Returns:

True if the point belongs to the B-spline curve, False otherwise

Return type:

bool

point_inversion(u0: float, point, maxiter: int = 50, tol1: float = 1e-07, tol2: float = 1e-08)[source]#

Finds the equivalent B-Spline curve parameter u to a given a point 3D or 2D using an initial guess u0.

Parameters:
  • u0 (float) – An initial guess between 0 and 1.

  • point (Union[volmdlr.Point2D, volmdlr.Point3D]) – Point to evaluation.

  • maxiter (int) – Maximum number of iterations.

  • tol1 (float) – Distance tolerance to stop.

  • tol2 (float) – Zero cos tolerance to stop.

Returns:

u parameter and convergence check

Return type:

int, bool

point_projection(point)[source]#

Calculates the projection of a point on the B-Spline.

Parameters:

point – point to be verified.

Returns:

point projection.

point_to_parameter(point: Point2D | Point3D)[source]#

Search for the value of the normalized evaluation parameter u.

Returns:

the given point when the BSplineCurve3D is evaluated at the u value.

property points#

Evaluate the BSpline points based on the set delta value of the curve.

property sample_size#

Sample size.

Sample size defines the number of evaluated points to generate. It also sets the delta property.

Getter:

Gets sample size

Setter:

Sets sample size

Type:

int

property simplify#

Search another simplified edge that can represent the bspline.

split(split_point: Point2D | Point3D, tol: float = 1e-06)[source]#

Splits of B-spline curve in two pieces using a 2D or 3D point.

Parameters:
  • split_point (Union[volmdlr.Point2D, volmdlr.Point3D]) – The point where the B-spline curve is split

  • tol (float, optional) – The precision in terms of distance. Default value is 1e-6

Returns:

A list containing the first and second split of the B-spline curve

Return type:

List[volmdlr.edges.BSplineCurve]

straight_line_point_belongs(point)[source]#

Verifies if a point belongs to the surface created by closing the edge.

Parameters:

point – Point to be verified

Returns:

Return True if the point belongs to this surface, or False otherwise

tangent(position: float = 0.0, normalize: bool = True)[source]#

Evaluates the tangent vector of the B-spline curve at the input parameter value.

Parameters:
  • position (float) – Value of the parameter, between 0 and 1

  • normalize – By default return a normalized tangent vector.

Returns:

The tangent vector

Return type:

Union[volmdlr.Point2D, volmdlr.Point3D]

to_dict(*args, **kwargs)[source]#

Avoids storing points in memo that makes serialization slow.

to_geomdl()[source]#

Converts the BSpline curve into a geomdl curve.

translation(offset: Vector2D | Vector3D)[source]#

Translates the B-spline curve.

Parameters:

offset (Union[volmdlr.Vector2D, volmdlr.Vector3D]) – The translation vector

Returns:

A new translated BSplineCurve

Return type:

volmdlr.edges.BSplineCurve

trim(point1: Point3D, point2: Point3D, same_sense: bool = True, abs_tol: float = 1e-06)[source]#

Trims a bspline curve between two points.

Parameters:
  • point1 – point 1 used to trim.

  • point2 – point2 used to trim.

  • same_sense – Used for periodical curves only. Indicates whether the curve direction agrees with (True) or is in the opposite direction (False) to the edge direction. By default, it’s assumed True

  • abs_tol – Point confusion precision.

Returns:

New BSpline curve between these two points.

class volmdlr.edges.BSplineCurve2D(degree: int, control_points: List[Point2D], knot_multiplicities: List[int], knots: List[float], weights: List[float] | None = None, name: str = '')[source]#

Bases: BSplineCurve

A class for 2-dimensional B-spline curves.

The following rule must be respected : number of knots = number of control points + degree + 1.

Parameters:
  • degree (int) – The degree of the 2-dimensional B-spline curve

  • control_points (List[volmdlr.Point2D]) – A list of 2-dimensional points

  • knot_multiplicities (List[int]) – The vector of multiplicities for each knot

  • knots (List[float]) – The knot vector composed of values between 0 and 1

  • weights (List[float], optional) – The weight vector applied to the knot vector. Default value is None

  • periodic (bool, optional) – If True the B-spline curve is periodic. Default value is False

  • name (str, optional) – The name of the B-spline curve. Default value is ‘’

arc_intersections(arc, abs_tol=1e-06)[source]#

Calculates intersections between a BSpline Curve 2D and an arc 2D.

Parameters:
  • arc – arc to verify intersections.

  • abs_tol – tolerance.

Returns:

list with the intersections points.

axial_symmetry(line)[source]#

Finds out the symmetric bsplinecurve2d according to a line.

property bounding_rectangle#

Computes the bounding rectangle of the 2-dimensional B-spline curve.

Returns:

The bounding rectangle.

Return type:

volmdlr.core.BoundingRectangle

bsplinecurve_intersections(bspline, abs_tol=1e-06)[source]#

Calculates intersections between two BSpline Curve 2D.

Parameters:
  • bspline – bspline to verify intersections.

  • abs_tol – tolerance.

Returns:

list with the intersections points.

get_bounding_element()[source]#

Gets bounding box if a 3D object, or bounding rectangle if 2D.

get_reverse()[source]#

Reverse the BSpline’s direction by reversing its start and end points.

is_shared_section_possible(other_bspline2, tol)[source]#

Verifies if it there is any possibility of the two bsplines share a section.

Parameters:
  • other_bspline2 – other bspline.

  • tol – tolerance used.

Returns:

True or False.

line_crossings(line2d: Line2D)[source]#

Bspline Curve crossings with a line 2d.

linesegment_intersections(linesegment2d, abs_tol: float = 1e-06)[source]#

Calculates intersections between a BSpline Curve 2D and a Line Segment 2D.

Parameters:
  • linesegment2d – line segment to verify intersections.

  • abs_tol – tolerance.

Returns:

list with the intersections points.

nearest_point_to(point)[source]#

Find out the nearest point on the linesegment to point.

normal(position: float = 0.0)[source]#

Normal vector to BPlineCurve2D.

offset(offset_length: float)[source]#

Offsets a BSplineCurve2D in one of its normal direction.

Parameters:

offset_length – the length taken to offset the BSpline. if positive, the offset is in the normal direction of the curve. if negative, in the opposite direction of the normal.

Returns:

returns an offset bsplinecurve2D, created with from_points_interpolation.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plot a B-Spline curve 2D.

rotation(center: Point2D, angle: float)[source]#

BSplineCurve2D rotation.

Parameters:
  • center – rotation center

  • angle – angle rotation

Returns:

a new rotated Line2D

straight_line_area()[source]#

Uses shoelace algorithm for evaluating the area.

straight_line_center_of_mass()[source]#

Straight line center of mass.

to_3d(plane_origin, x1, x2)[source]#

Transforms a B-Spline Curve 2D in 3D.

to_step(current_id, *args, **kwargs)[source]#

Exports to STEP format.

class volmdlr.edges.BSplineCurve3D(degree: int, control_points: List[Point3D], knot_multiplicities: List[int], knots: List[float], weights: List[float] | None = None, name: str = '')[source]#

Bases: BSplineCurve

A class for 3-dimensional B-spline curves.

The following rule must be respected : number of knots = number of control points + degree + 1

Parameters:
  • degree (int) – The degree of the 3-dimensional B-spline curve

  • control_points (List[volmdlr.Point3D]) – A list of 3-dimensional points

  • knot_multiplicities (List[int]) – The vector of multiplicities for each knot

  • knots (List[float]) – The knot vector composed of values between 0 and 1

  • weights (List[float], optional) – The weight vector applied to the knot vector. Default value is None

  • periodic (bool, optional) – If True the B-spline curve is periodic. Default value is False

  • name (str, optional) – The name of the B-spline curve. Default value is ‘’

arc_intersections(arc, abs_tol=1e-06)[source]#

Calculates intersections between a BSpline Curve 3D and an arc 3D.

Parameters:
  • arc – arc to verify intersections.

  • abs_tol – tolerance.

Returns:

list with the intersections points.

property bounding_box#

Returns bounding box.

circle_intersections(circle, abs_tol: float = 1e-06)[source]#

Get the intersections with the specified circle.

curvature(u: float, point_in_curve: bool = False)[source]#

Returns the curvature of a curve and the point where it is located.

curve_intersections(curve, abs_tol: float = 1e-06)[source]#

Get the intersections with the specified curve.

direction_vector(abscissa=0.0)[source]#

Gets direction vector at given abscissa value (value between o and bspline length).

classmethod from_step(arguments, object_dict, **kwargs)[source]#

Converts a step primitive to a BSplineCurve3D.

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 BSplineCurve3D.

Return type:

volmdlr.edges.BSplineCurve3D

get_bounding_element()[source]#

Gets bounding box if a 3D object, or bounding rectangle if 2D.

get_direction_vector(abscissa=0.0)[source]#

Calculates direction vector at given abscissa value (value between o and bspline length).

global_maximum_curvature(nb_eval: int = 21, point_in_curve: bool = False)[source]#

Returns the global maximum curvature of a curve and the point where it is located.

insert_knot(knot: float, num: int = 1)[source]#

Returns a new BSplineCurve3D.

is_shared_section_possible(other_bspline2, tol)[source]#

Verifies if it there is any possibility of the two bsplines share a section.

Parameters:
  • other_bspline2 – other bspline.

  • tol – tolerance used.

Returns:

True or False.

linesegment_intersections(linesegment3d: LineSegment3D, abs_tol: float = 1e-06)[source]#

Calculates intersections between a BSplineCurve3D and a LineSegment3D.

Parameters:
  • linesegment3d – linesegment to verify intersections.

  • abs_tol – tolerance.

Returns:

list with the intersections points.

look_up_table(resolution: int = 20, start_parameter: float = 0, end_parameter: float = 1)[source]#

Creates a table of equivalence between parameter t (evaluation of BSplineCurve) and the cumulative distance.

Parameters:
  • resolution (int, optional) – The precision of the table. Auto-adjusted by the algorithm. Default value set to 20

  • start_parameter (float, optional) – First parameter evaluated in the table. Default value set to 0

  • end_parameter – Last parameter evaluated in the table. Default value set to 1

Returns:

Yields a list of tuples containing the parameter and the cumulated distance along the BSplineCruve3D from the evaluation of start_parameter

Return type:

Tuple[float, float]

maximum_curvature(point_in_curve: bool = False)[source]#

Returns the maximum curvature of a curve and the point where it is located.

minimum_radius(point_in_curve=False)[source]#

Returns the minimum curvature radius of a curve and the point where it is located.

move_frame_along(frame, *args, **kwargs)[source]#

Moves frame along the edge.

normal(position: float = 0.0)[source]#

Returns the normal vector at a given parameter of the curve.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Matplotlib plot method for a BSpline Curve 3D.

revolution(axis_point, axis, angle)[source]#

Returns the face generated by the revolution of the BSpline Curve 3D.

rotation(center: Point3D, axis: Vector3D, angle: float)[source]#

BSplineCurve3D rotation.

Parameters:
  • center – rotation center

  • axis – rotation axis

  • angle – angle rotation

Returns:

a new rotated BSplineCurve3D

sweep(*args, **kwargs)[source]#

Bspline 3D is used as path for sweeping given section through it.

Returns:

to_2d(plane_origin, x, y)[source]#

Transforms a BSplineCurve3D into an BSplineCurve2D, given a plane origin and an u and v plane vector.

Parameters:
  • plane_origin – plane origin.

  • x – plane u vector.

  • y – plane v vector.

Returns:

BSplineCurve2D.

to_step(current_id, surface_id=None, curve2d=None)[source]#

Exports to STEP format.

triangulation()[source]#

Triangulation method for a BSplineCurve3D.

trim_between_evaluations(parameter1: float, parameter2: float)[source]#

Trims the Bspline between two abscissa evaluation parameters.

Parameters:
  • parameter1 – evaluation parameter 1, bigger than 0 and smaller than its length.

  • parameter2 – evaluation parameter 2, bigger than 0 and smaller than its length.

class volmdlr.edges.BezierCurve2D(degree: int, control_points: List[Point2D], name: str = '')[source]#

Bases: BSplineCurve2D

A class for 2-dimensional Bézier curves.

Parameters:
  • degree (int) – The degree of the Bézier curve.

  • control_points (List[volmdlr.Point2D]) – A list of 2-dimensional points

  • name (str, optional) – The name of the B-spline curve. Default value is ‘’

class volmdlr.edges.BezierCurve3D(degree: int, control_points: List[Point3D], name: str = '')[source]#

Bases: BSplineCurve3D

A class for 3-dimensional Bézier curves.

Parameters:
  • degree (int) – The degree of the Bézier curve

  • control_points (List[volmdlr.Point3D]) – A list of 3-dimensional points

  • name (str, optional) – The name of the B-spline curve. Default value is ‘’

class volmdlr.edges.Edge(start, end, reference_path: str = '#', name='')[source]#

Bases: DessiaObject

Defines a simple edge Object.

abscissa(point, tol: float = 1e-06)[source]#

Computes the abscissa of an Edge.

Parameters:
  • point (Union[volmdlr.Point2D, volmdlr.Point3D].) – The point located on the edge.

  • tol (float, optional.) – The precision in terms of distance. Default value is 1e-4.

Returns:

The abscissa of the point.

Return type:

float

abscissa_discretization(abscissa1, abscissa2, max_number_points: int = 10, return_abscissas: bool = True)[source]#

Gets n discretization points between two given points of the edge.

Parameters:
  • abscissa1 – Initial abscissa.

  • abscissa2 – Final abscissa.

  • max_number_points – Expected number of points to discretize locally.

  • return_abscissas – By default, returns also a list of abscissas corresponding to the discretization points

Returns:

list of locally discretized point and a list containing the abscissas’ values.

crossings(edge)[source]#

Gets the crossings between two edges.

curve()[source]#

Returns the curve that defines the geometry of the edge.

delete_shared_section(other_arc2, abs_tol: float = 1e-06)[source]#

Deletes from self, the section shared with the other arc.

Parameters:
  • other_arc2

  • abs_tol – tolerance.

Returns:

direction_independent_is_close(other_edge, tol: float = 1e-06)[source]#

Verifies if two line segments are the same, not considering its direction.

direction_vector(abscissa)[source]#

Calculates the direction vector the edge at given abscissa.

Parameters:

abscissa – edge abscissa

Returns:

direction vector

discretization_points(*, number_points: int | None = None, angle_resolution: int | None = None)[source]#

Discretize an Edge to have “n” points.

Parameters:
  • number_points – the number of points (including start and end points) if unset, only start and end will be returned

  • angle_resolution – if set, the sampling will be adapted to have a controlled angular distance. Useful to mesh an arc

Returns:

a list of sampled points

classmethod from_step(arguments, object_dict, **kwargs)[source]#

Converts a step primitive to an Edge type object.

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 Edge object

Return type:

volmdlr.edges.Edge

generic_get_shared_section(other_edge, abs_tol: float = 1e-06)[source]#

Generic method to Get the shared section between two arcs of ellipse.

Parameters:
  • other_edge – other edge to verify for shared section.

  • abs_tol – tolerance.

Returns:

shared arc section.

generic_minimum_distance(element, return_points=False)[source]#

Gets the minimum distance between two elements.

This is a generalized method in a case an analytical method has not yet been defined.

Parameters:
  • element – other element.

  • return_points – Weather to return the corresponding points or not.

Returns:

distance to edge.

get_reverse()[source]#

Gets the same edge, but in the opposite direction.

get_shared_section(*args, **kwargs)[source]#

Gets the shared section between two arcs of ellipse.

intersections(edge2: Edge, abs_tol: float = 1e-06, force_sort: bool = False)[source]#

Gets the intersections between two edges.

Parameters:
  • edge2 – other edge.

  • abs_tol – tolerance.

Returns:

list of intersection points.

is_close(other_edge, tol: float = 1e-06)[source]#

Verify if two edges are equal, considering a certain tolerance.

is_point_edge_extremity(other_point, abs_tol: float = 1e-06)[source]#

Verifies if a point is the start or the end of the edge.

Parameters:
  • other_point – other point to verify if it is any end of the edge.

  • abs_tol – tolerance.

Returns:

True of False.

length()[source]#

Calculates the edge’s length.

local_discretization(point1, point2, number_points: int = 10)[source]#

Gets n discretization points between two given points of the edge.

Parameters:
  • point1 – point 1 on edge.

  • point2 – point 2 on edge.

  • number_points – number of points to discretize locally.

Returns:

list of locally discretized points.

middle_point()[source]#

Gets the middle point for an edge.

Returns:

minimum_distance(element, return_points=False)[source]#

Evaluates the minimal distance between the edge and another specified primitive.

Parameters:
  • element – Another primitive object to compute the distance to.

  • return_points (bool) – (optional) If True, return the closest points on both primitives.

Returns:

The minimum distance between the edge and the specified primitive. tuple, optional: A tuple containing the closest points if return_points is True.

normal_vector(abscissa)[source]#

Calculates the normal vector the edge at given abscissa.

Returns:

the normal vector

property periodic#

Returns True if edge is periodic.

point_at_abscissa(abscissa)[source]#

Calculates the point at given abscissa.

point_belongs(point, abs_tol: float = 1e-06)[source]#

Checks if a point belongs to the edge.

Parameters:
  • point (Union[volmdlr.Point2D, volmdlr.Point3D]) – The point to be checked

  • abs_tol (float, optional) – The precision in terms of distance. Default value is 1e-6

Returns:

True if the point belongs to the edge, False otherwise

Return type:

bool

point_distance(point: Point2D | Point3D)[source]#

Calculates the distance from a given point.

Parameters:

point (Union[volmdlr.Point2D, volmdlr.Point3D]) – The point to be checked.

Returns:

distance.

polygon_points(discretization_resolution: int)[source]#

Deprecated method of discretization_points.

reverse()[source]#

Gets the edge in the reverse direction.

property simplify#

Search another simplified edge that can represent the edge.

sort_points_along_curve(points: List[Point2D | Point3D])[source]#

Sort point along a curve.

Parameters:

points – list of points to be sorted.

Returns:

sorted points.

split(split_point, tol: float = 1e-06)[source]#

Gets the same edge, but in the opposite direction.

straight_line_point_belongs(point)[source]#

Verifies if a point belongs to the surface created by closing the edge.

Parameters:

point – Point to be verified

Returns:

Return True if the point belongs to this surface, or False otherwise

to_step(current_id: int, *args, **kwargs)[source]#

Converts the object to a STEP representation.

Parameters:

current_id (int) – The ID of the last written primitive.

Returns:

The STEP representation of the object and the last ID.

Return type:

tuple[str, list[int]]

touching_points(edge2)[source]#

Verifies if two edges are touching each other.

In case these two edges are touching each other, return these touching points.

Parameters:

edge2 – edge2 to verify touching points.

Returns:

list of touching points.

trim(point1, point2, *args, **kwargs)[source]#

Trims edge between two points.

Parameters:
  • point1 – point 1.

  • point2 – point 2.

Returns:

edge trimmed.

unit_direction_vector(abscissa: float = 0.0)[source]#

Calculates the unit direction vector the edge at given abscissa.

Parameters:

abscissa – edge abscissa

Returns:

unit direction vector

unit_normal_vector(abscissa: float = 0.0)[source]#

Calculates the unit normal vector the edge at given abscissa.

Parameters:

abscissa – edge abscissa

Returns:

unit normal vector

validate_crossings(edge, intersection)[source]#

Validates the intersections as crossings: edge not touching the other at one end, or in a tangent point.

class volmdlr.edges.FullArc2D(circle: Circle2D, start_end: Point2D, reference_path: str = '#', name: str = '')[source]#

Bases: FullArcMixin, Arc2D

An edge that starts at start_end, ends at the same point after having described a circle.

property bounding_rectangle#

Gets the bounding rectangle for a full arc 2d.

center_of_mass()[source]#

Gets the center of the full arc 2d.

copy(*args, **kwargs)[source]#

Creates a copy of a fullarc 2d.

classmethod dict_to_object(dict_, *args, **kwargs)[source]#

Create a FullArc2D object from a dictionary representation.

This class method takes a dictionary containing the necessary data for creating a FullArc2D object and returns an instance of the FullArc2D class. It expects the dictionary to have the following keys:

Parameters:
  • cls – The FullArc2D 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:

FullArc2D: An instance of the FullArc2D class created from the provided dictionary.

frame_mapping(frame: Frame2D, side: str)[source]#

Map the 2D full arc to a new frame or its original frame.

Parameters:
  • frame (volmdlr.Frame2D) – The target frame for the mapping.

  • side (str) – Specify whether to map the arc to the new frame (‘new’) or its original frame (‘old’).

Returns:

The full arc in the specified frame.

Return type:

volmdlr.edges.FullArc2D

classmethod from_3_points(point1, point2, point3, reference_path: str = '#', name: str = '')[source]#

Creates a circle 2d from 3 points.

Returns:

circle 2d.

get_reverse()[source]#

Reverse of full arc 2D.

line_intersections(line2d: Line2D, tol=1e-09)[source]#

Full Arc 2D intersections with a Line 2D.

linesegment_intersections(linesegment2d: LineSegment2D, abs_tol=1e-09)[source]#

Full arc 2D intersections with a line segment.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plots a fullarc using Matplotlib.

point_belongs(point: Point2D, abs_tol: float = 1e-06)[source]#

Returns if given point belongs to the FullArc2D.

polygonization()[source]#

Creates a Polygon from a full arc 2d.

rotation(center: Point2D, angle: float)[source]#

Rotation of a full arc 2D.

straight_line_area()[source]#

Calculates the area of the full arc, with line drawn from start to end.

Returns:

straight_line_area.

straight_line_center_of_mass()[source]#

Straight line center of mass.

straight_line_point_belongs(point)[source]#

Verifies if a point belongs to the surface created by closing the edge.

Parameters:

point – Point to be verified.

Returns:

Return True if the point belongs to this surface, or False otherwise.

to_3d(plane_origin, x, y)[source]#

Transforms the full arc 2D into a 3D full arc.

Parameters:
  • plane_origin (volmdlr.Point3D) – The origin of plane to draw the full arc 3D.

  • x (volmdlr.Vector3D) – First direction of the plane

  • y (volmdlr.Vector3D) – Second direction of the plane.

Returns:

A 3D full arc.

Type:

Full Arc 3D.

to_dict(use_pointers: bool = False, memo=None, path: str = '#', id_method=True, id_memo=None, **kwargs)[source]#

Stores all Full Arc 2D attributes in a dict object.

translation(offset: Vector2D)[source]#

Translation of a full arc 2D.

class volmdlr.edges.FullArc3D(circle: Circle3D, start_end: Point3D, name: str = '')[source]#

Bases: FullArcMixin, Arc3D

An edge that starts at start_end, ends at the same point after having described a circle.

copy(*args, **kwargs)[source]#

Returns a new instance with the same parameters.

frame_mapping(frame: Frame3D, side: str)[source]#

Changes vector frame_mapping and return a new FullArc3D.

side = ‘old’ or ‘new’

classmethod from_3_points(point1, point2, point3, name: str = '')[source]#

Creates a full arc 3D from 3 given points.

classmethod from_center_normal(center: Point3D, normal: Vector3D, start_end: Point3D, name: str = '')[source]#

Creates a Full Arc 3D using a center, and a normal vector and a start point.

Parameters:
  • center – full arc center.

  • normal – circle normal

  • start_end – full arc starting point.

  • name – full arc’s name.

Returns:

FullArc3D.

classmethod from_curve(circle, start_end=None, name: str = '')[source]#

Initialize a full arc from a circle.

fullarc_intersections(fullarc3d, abs_tol: float = 1e-06)[source]#

Calculates the intersections between two full arc 3d.

Parameters:
  • fullarc3d – linesegment 3d to verify intersections.

  • abs_tol – tolerance.

Returns:

list of points 3d, if there are any intersections, an empty list if otherwise.

get_reverse()[source]#

Defines a new FullArc3D, identical to self, but in the opposite direction.

linesegment_intersections(linesegment3d: LineSegment3D, abs_tol=1e-06)[source]#

Calculates the intersections between a full arc 3d and a line segment 3d.

Parameters:
  • linesegment3d – linesegment 3d to verify intersections.

  • abs_tol – tolerance.

Returns:

list of points 3d, if there are any intersections, an empty list if otherwise.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True), show_frame=False)[source]#

Plot fullarc3d using matplotlib.

point_belongs(point: Point3D, abs_tol: float = 1e-06)[source]#

Returns if given point belongs to the FullArc3D.

rotation(center: Point3D, axis: Vector3D, angle: float)[source]#

Rotates the FullArc3D object around a specified axis by a given angle.

Parameters:
  • center ((volmdlr.Point3D)) – The center point of rotation.

  • axis ((volmdlr.Vector3D)) – The axis of rotation.

  • angle ((float)) – The angle of rotation in radians.

Returns:

A new FullArc3D object that is the result of the rotation.

Return type:

FullArc3D:

split(split_point, tol: float = 1e-06)[source]#

Splits the circle into two arcs at a given point.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list of two arcs.

to_2d(plane_origin, x, y)[source]#

Transforms a FullArc3D into an FullArc2D, given a plane origin and an u and v plane vector.

Parameters:
  • plane_origin – plane origin.

  • x – plane u vector.

  • y – plane v vector.

Returns:

FullArc2D.

to_dict(use_pointers: bool = False, memo=None, path: str = '#')[source]#

Object serialization.

to_step(current_id, surface_id=None)[source]#

Exports to STEP format.

translation(offset: Vector3D)[source]#

Translates the FullArc3D object by a specified offset.

Parameters:

offset ((volmdlr.Vector3D).) – The translation offset vector.

Returns:

A new FullArc3D object that is the result of the translation.

Return type:

FullArc3D.

class volmdlr.edges.FullArcEllipse(ellipse: Ellipse2D | Ellipse3D, start_end: Point2D | Point3D, name: str = '')[source]#

Bases: Edge

Abstract class to define an ellipse.

abscissa(point, tol: float = 1e-06)[source]#

Computes the abscissa of an Edge.

Parameters:
  • point (Union[volmdlr.Point2D, volmdlr.Point3D].) – The point located on the edge.

  • tol (float, optional.) – The precision in terms of distance. Default value is 1e-4.

Returns:

The abscissa of the point.

Return type:

float

property angle_end#

Get ellipse starting angle.

property angle_start#

Get ellipse starting angle.

property center#

Gets ellipse’s center point.

classmethod from_curve(ellipse, name: str = '')[source]#

Creates a fullarc ellipse from a ellipse curve.

get_reverse()[source]#

Defines a new FullArcEllipse, identical to self, but in the opposite direction.

length()[source]#

Calculates the length of the ellipse.

Ramanujan’s approximation for the perimeter of the ellipse. P = math.pi * (a + b) [ 1 + (3h) / (10 + √(4 - 3h) ) ], where h = (a - b)**2/(a + b)**2.

Returns:

Perimeter of the ellipse

Return type:

float

property periodic#

Returns True if edge is periodic.

point_belongs(point: Point2D | Point3D, abs_tol: float = 0.01)[source]#

Verifies if a given point lies on the ellipse.

Parameters:
  • point – point to be verified.

  • abs_tol – Absolute tolerance to consider the point on the ellipse (0.99 should be considered True).

Returns:

True is point lies on the ellipse, False otherwise

straight_line_point_belongs(point)[source]#

Verifies if a point belongs to the surface created by closing the edge.

Parameters:

point – Point to be verified

Returns:

Return True if the point belongs to this surface, or False otherwise

class volmdlr.edges.FullArcEllipse2D(ellipse: Ellipse2D, start_end: Point2D, name: str = '')[source]#

Bases: FullArcEllipse, ArcEllipse2D

Defines a FullArcEllipse2D.

abscissa(point: Point2D | Point3D, tol: float = 1e-06)[source]#

Calculates the abscissa of a given point.

Parameters:
  • point – point for calculating abscissa.

  • tol – tolerance.

Returns:

a float, between 0 and the ellipse’s length.

frame_mapping(frame: Frame2D, side: str)[source]#

Changes frame_mapping and return a new FullArcEllipse2D.

Parameters:
  • frame (volmdlr.Frame2D) – Local coordinate system.

  • side (str) – ‘old’ will perform a transformation from local to global coordinates. ‘new’ will perform a transformation from global to local coordinates.

Returns:

A new transformed FulLArcEllipse2D.

Return type:

FullArcEllipse2D

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Matplotlib plot for an ellipse.

to_3d(plane_origin, x, y)[source]#

Transforms the full arc of ellipse 2D into a 3D full arc of ellipse.

Parameters:
  • plane_origin (volmdlr.Point3D) – The origin of plane to draw the full arc of ellipse 3D.

  • x (volmdlr.Vector3D) – First direction of the plane

  • y (volmdlr.Vector3D) – Second direction of the plane.

Returns:

A 3D full arc of ellipse.

Return type:

FullArcEllipse3D

translation(offset: Vector2D)[source]#

Full ArcEllipse 2D translation.

Parameters:

offset (volmdlr.Vector2D) – translation vector.

Returns:

A new translated FullArcEllipse2D.

Return type:

FullArcEllipse2D

class volmdlr.edges.FullArcEllipse3D(ellipse: Ellipse3D, start_end: Point3D, name: str = '')[source]#

Bases: FullArcEllipse, ArcEllipse3D

Defines a FullArcEllipse3D.

abscissa(point: Point3D, tol: float = 1e-06)[source]#

Calculates the abscissa a given point.

Parameters:
  • point – point to calculate abscissa.

  • tol – tolerance allowed.

Returns:

abscissa

classmethod dict_to_object(dict_, *args, **kwargs)[source]#

Create a FullArcEllipse3D object from a dictionary representation.

This class method takes a dictionary containing the necessary data for creating a FullArcEllipse3D object and returns an instance of the FullArcEllipse3D class. It expects the dictionary to have the following keys:

Parameters:
  • cls – The FullArcEllipse3D 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:

FullArcEllipse3D: An instance of the FullArcEllipse3D class created from the provided dictionary.

frame_mapping(frame: Frame3D, side: str)[source]#

Changes frame_mapping and return a new FullArcEllipse3D.

Parameters:
  • frame (volmdlr.Frame3D) – Local coordinate system.

  • side (str) – ‘old’ will perform a transformation from local to global coordinates. ‘new’ will perform a transformation from global to local coordinates.

Returns:

A new transformed FulLArcEllipse3D.

Return type:

FullArcEllipse3D

line_intersections(line, abs_tol: float = 1e-06)[source]#

Gets intersections between an Ellipse 3D and a Line3D.

Parameters:
  • line – Other Line 3D.

  • abs_tol – tolerance.

Returns:

A list of points, containing all intersections between the Line 3D and the Ellipse3D.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Ellipse plot.

split(split_point, tol: float = 1e-06)[source]#

Splits the ellipse into two arc of ellipse at a given point.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list of two Arc of ellipse.

to_2d(plane_origin, x, y)[source]#

Transforms a FullArcEllipse3D into an FullArcEllipse2D, given an plane origin and a u and v plane vector.

Parameters:
  • plane_origin – plane origin.

  • x – plane u vector.

  • y – plane v vector.

Returns:

FullArcEllipse2D.

to_dict(use_pointers: bool = False, memo=None, path: str = '#')[source]#

Transforms an instance of a Full arc ellipse into a dictionary.

translation(offset: Vector3D)[source]#

Ellipse3D translation.

Parameters:

offset (volmdlr.Vector3D) – translation vector.

Returns:

A new translated FullArcEllipse3D.

Return type:

FullArcEllipse3D

class volmdlr.edges.FullArcMixin(circle: Circle2D | Circle3D, start_end: Point2D | Point3D, name: str = '')[source]#

Bases: ArcMixin

Abstract class for representing a circle with a start and end points that are the same.

property angle#

Angle of Full Arc.

classmethod from_curve(circle, name: str = '')[source]#

Creates A full arc, 2d or 3d, from circle.

property periodic#

Return True if an edge is periodic.

split(split_point, tol: float = 1e-06)[source]#

Splits arc at a given point.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list of two Arc.

class volmdlr.edges.LineSegment(start: Point2D | Point3D, end: Point2D | Point3D, reference_path: str = '#', name: str = '')[source]#

Bases: Edge

Abstract class.

abscissa(point, tol=1e-06)[source]#

Calculates the abscissa parameter of a Line Segment, at a point.

Parameters:
  • point – point to verify abscissa.

  • tol – tolerance.

Returns:

abscissa parameter.

direction_vector(abscissa=0.0)[source]#

Returns a direction vector at a given abscissa, it is not normalized.

Parameters:

abscissa – defines where in the line segment direction vector is to be calculated.

Returns:

The direction vector of the LineSegment.

get_geo_lines(tag: int, start_point_tag: int, end_point_tag: int)[source]#

Gets the lines that define a LineSegment in a .geo file.

Parameters:
  • tag (int) – The linesegment index

  • start_point_tag (int) – The linesegment’ start point index

  • end_point_tag (int) – The linesegment’ end point index

Returns:

A line

Return type:

str

get_geo_points()[source]#

Returns geo points.

get_shared_section(other_linesegment, abs_tol: float = 1e-06)[source]#

Gets the shared section between two line segments.

Parameters:
  • other_linesegment – other line segment to verify for shared section.

  • abs_tol – tolerance.

Returns:

shared line segment section.

is_close(other_edge, tol: float = 1e-06)[source]#

Checks if two line segments are the same considering the Euclidean distance.

Parameters:
  • other_edge – other line segment.

  • tol (float, optional.) – The tolerance under which the Euclidean distance is considered equal to 0, defaults to 1e-6.

length()[source]#

Gets the length of a Line Segment.

property line#

Returns the line from which the line segment was extracted.

middle_point()[source]#

Calculates the middle point of a Line Segment.

Returns:

normal_vector(abscissa=0.0)[source]#

Returns a normal vector at a given abscissa, it is not normalized.

Parameters:

abscissa – defines where in the line_segment

normal vector is to be calculated. :return: The normal vector of the LineSegment.

point_at_abscissa(abscissa)[source]#

Calculates a point in the LineSegment at a given abscissa.

Parameters:

abscissa – abscissa where in the curve the point should be calculated.

Returns:

Corresponding point.

point_belongs(point: Point2D | Point3D, abs_tol: float = 1e-06)[source]#

Checks if a point belongs to the line segment. It uses the point_distance.

Parameters:
  • point (Union[volmdlr.Point2D, volmdlr.Point3D]) – The point to be checked

  • abs_tol (float, optional) – The precision in terms of distance. Default value is 1e-6

Returns:

True if the point belongs to the B-spline curve, False otherwise

Return type:

bool

point_distance(point)[source]#

Abstract method.

point_projection(point)[source]#

Calculates the projection of a point on a Line Segment.

Parameters:

point – point to be verified.

Returns:

point projection.

split(split_point, tol: float = 1e-06)[source]#

Split a Line Segment at a given point into two Line Segments.

Parameters:
  • split_point – splitting point.

  • tol – tolerance.

Returns:

list with the two split line segments.

straight_line_point_belongs(point)[source]#

Closing straight line point belongs verification.

Verifies if a point belongs to the surface created by closing the edge with a line between its start and end points.

Parameters:

point – Point to be verified.

Returns:

Return True if the point belongs to this surface, or False otherwise.

to_dict(*args, **kwargs)[source]#

Define custom base to_dict for LineSegment children.

class volmdlr.edges.LineSegment2D(start: Point2D, end: Point2D, reference_path: str = '#', name: str = '')[source]#

Bases: LineSegment

Define a line segment limited by two points.

axial_symmetry(line)[source]#

Finds out the symmetric linesegment2d according to a line.

property bounding_rectangle#

Evaluates the bounding rectangle of the Line segment.

closest_point_on_segment(point)[source]#

Gets the closest point on the line segment and another given point.

copy(deep=True, memo=None)[source]#

A specified copy of a LineSegment2D.

create_tangent_circle(point, other_line)[source]#

Create a circle tangent to a LineSegment.

distance_linesegment(linesegment, return_points=False)[source]#

Calculates the minimum distance between two line segments.

Parameters:
  • linesegment – other line segment.

  • return_points – boolean weather to return the minimum distance corresponding points or not.

Returns:

minimum distance / minimal distance with corresponding points.

frame_mapping(frame: Frame2D, side: str)[source]#

Changes vector frame_mapping and return a new LineSegment2D.

side = ‘old’ or ‘new’.

get_reverse()[source]#

Invert the sense of the line segment.

infinite_primitive(offset)[source]#

Get an infinite primitive.

line_crossings(line: Line2D)[source]#

Line Segment crossings with line 2d.

line_distance(line, return_points: bool = False)[source]#

Calculates the distance between a Line Segment and an infinite Line.

Parameters:
  • line – other line.

  • return_points – weather to return corresponding points or not.

Returns:

distance between line and line segment.

line_intersections(line: Line2D)[source]#

Line Segment intersections with volmdlr_curves.Line2D.

linesegment_intersections(linesegment2d: LineSegment2D, abs_tol=1e-06)[source]#

Touching line segments does not intersect.

nearest_point_to(point)[source]#

Find out the nearest point on the linesegment to point.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plots the Linesegment2D.

plot_data(edge_style: EdgeStyle | None = None)[source]#

Plot data method for a LineSegment2D.

Parameters:

edge_style – edge style.

Returns:

plot_data.LineSegment2D object.

point_distance(point, return_other_point=False)[source]#

Computes the distance of a point to segment of line.

Parameters:
  • point – point to calculate distance.

  • return_other_point – Boolean variable to return line segment’s corresponding point or not.

point_projection(point)[source]#

If the projection falls outside the LineSegment2D, returns None.

rotation(center: Point2D, angle: float)[source]#

LineSegment2D rotation.

Parameters:
  • center – rotation center

  • angle – angle rotation

Returns:

a new rotated LineSegment2D

straight_line_area()[source]#

Calculates the area of the LineSegment2D, with line drawn from start to end.

Returns:

straight_line_area.

straight_line_center_of_mass()[source]#

Straight line center of mass.

straight_line_second_moment_area(*args, **kwargs)[source]#

Straight line second moment area for a line segment.

to_3d(plane_origin, x1, x2)[source]#

Transforms the Line segment 2D into a 3D line segment.

Parameters:
  • plane_origin (volmdlr.Point3D) – The origin of plane to draw the Line segment 3D.

  • x1 (volmdlr.Vector3D) – First direction of the plane

  • x2 (volmdlr.Vector3D) – Second direction of the plane.

Returns:

A 3D line segment.

Return type:

LineSegment3D

to_dict(*args, **kwargs)[source]#

Stores all Line Segment 2D attributes in a dict object.

translation(offset: Vector2D)[source]#

LineSegment2D translation.

Parameters:

offset – translation vector.

Returns:

A new translated LineSegment2D.

class volmdlr.edges.LineSegment3D(start: Point3D, end: Point3D, reference_path: str = '#', name: str = '')[source]#

Bases: LineSegment

Define a line segment limited by two points.

babylon_curves()[source]#

Returns the babylon representation of the edge.

property bounding_box#

Gets bounding box for Line Segment 3D.

copy(*args, **kwargs)[source]#

Returns a copy of the line segment.

distance_arc(arc3d, return_points=False)[source]#

Calculates the minimum distance between a line segment and an arc in 3d.

Parameters:
  • arc3d – other line segment.

  • return_points – boolean weather to return the minimum distance corresponding points or not.

Returns:

minimum distance / minimal distance with corresponding points.

distance_linesegment(linesegment, return_points=False)[source]#

Calculates the minimum distance between two line segments in 3d.

Parameters:
  • linesegment – other line segment.

  • return_points – boolean weather to return the minimum distance corresponding points or not.

Returns:

minimum distance / minimal distance with corresponding points.

extrusion(extrusion_vector)[source]#

Extrusion of a Line Segment 3D, in a specific extrusion direction.

Parameters:

extrusion_vector – the extrusion vector used.

Returns:

An extruded Plane Face 3D.

frame_mapping(frame: Frame3D, side: str)[source]#

Changes LineSegment3D frame_mapping and return a new LineSegment3D.

side = ‘old’ or ‘new’

get_reverse()[source]#

Gets the reverse of the Line Segment.

line_distance(line, return_points: bool = False)[source]#

Calculates the distance between a Line Segment and an infinite Line.

Parameters:
  • line – other line.

  • return_points – weather to return corresponding points or not.

Returns:

distance between line and line segment.

line_intersections(line, tol: float = 1e-06)[source]#

Gets the intersection between a line segment 3d and line3D.

Parameters:
  • line – other line.

  • tol – maximum tolerance.

Returns:

a list with the intersection points.

linesegment_intersections(linesegment, abs_tol: float = 1e-06)[source]#

Gets the intersection between a line segment 3d and another line segment 3D.

Parameters:
  • linesegment – other line segment.

  • abs_tol – tolerance.

Returns:

a list with the intersection points.

matrix_distance(other_line)[source]#

Gets the points corresponding to the distance between to lines using matrix distance.

Parameters:

other_line – Other line.

Returns:

Two points corresponding to the distance between to lines.

minimum_distance_points(other_line)[source]#

Returns the points on this line and on the other line that are the closest of lines.

move_frame_along(frame)[source]#

Move frame along edge.

normal_vector(abscissa=0.0)[source]#

Returns the normal vector to the curve at the specified abscissa.

parallel_distance(other_linesegment)[source]#

Calculates the parallel distance between two Line Segments 3D.

plane_projection2d(center, x, y)[source]#

Calculates the projection of a line segment 3d on to a plane.

Parameters:
  • center – plane center.

  • x – plane u direction.

  • y – plane v direction.

Returns:

line segment 3d.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Plots the Line segment 3d using matplotlib.

plot2d(x_3d, y_3d, ax=None, color='k', width=None)[source]#

Creates a 2d plot of the Line segment 3d using matplotlib.

plot_data(x_3d, y_3d, edge_style=<plot_data.core.EdgeStyle object>)[source]#

Plot a Line Segment 3D object using dessia’s plot_data library.

point_distance(point)[source]#

Returns the minimal distance to a point.

revolution(axis_point, axis, angle)[source]#

Returns the face generated by the revolution of the line segments.

rotation(center: Point3D, axis: Vector3D, angle: float)[source]#

LineSegment3D rotation.

Parameters:
  • center – rotation center

  • axis – rotation axis

  • angle – angle rotation

Returns:

a new rotated LineSegment3D

sweep(*args)[source]#

Line Segment 3D is used as path for sweeping given section through it.

Returns:

to_2d(plane_origin, x, y)[source]#

Transforms a LineSegment3D into an LineSegment2D, given a plane origin and an u and v plane vector.

Parameters:
  • plane_origin – plane origin.

  • x – plane u vector.

  • y – plane v vector.

Returns:

LineSegment2D.

to_bspline_curve(resolution=10)[source]#

Convert a LineSegment3D to a BSplineCurve3D.

to_dict(*args, **kwargs)[source]#

Stores all Line Segment 3D in a dict object.

translation(offset: Vector3D)[source]#

LineSegment3D translation.

Parameters:

offset – translation vector

Returns:

A new translated LineSegment3D

unit_normal_vector(abscissa=0.0)[source]#

Calculates the Line segment’s unit normal vector.