topologicpy.Edge module
- class topologicpy.Edge.Edge
Bases:
objectMethods
Align2D(edgeA, edgeB)Compute the 4x4 transformation matrix to fully align edgeA to edgeB.
Angle(edgeA, edgeB[, mantissa, bracket])Returns the angle in degrees between the two input edges.
Arc([origin, radius, fromAngle, toAngle, ...])Creates a single open circular arc Edge.
ArcByVertices(startVertex, middleVertex, ...)Creates one exact circular arc Edge through three input vertices.
Bezier(controlPoints[, weights, tolerance, ...])Creates a single exact Bezier curve Edge.
Bisect(edgeA, edgeB[, length, placement, ...])Creates a bisecting edge between edgeA and edgeB.
ByCurve(controlPoints[, degree, isPeriodic, ...])Creates a non-rational B-spline edge using the input vertices as control points.
ByFaceNormal(face[, origin, length, tolerance])Creates a straight edge representing the normal to the input face.
ByNurbsParameters(controlPoints[, weights, ...])Creates an edge from exact NURBS/B-spline parameters.
ByOffset2D(edge[, offset, tolerance, silent])Creates a single Edge offset from the input Edge in the XY plane.
ByOriginDirectionLength([origin, direction, ...])Creates a straight edge from the input parameters.
ByStartVertexEndVertex(vertexA, vertexB[, ...])Creates a straight edge that connects the input vertices.
ByVertices(*vertices[, tolerance, silent])Creates a straight edge that connects the input list of vertices.
ByVerticesCluster(cluster[, tolerance])Creates a straight edge that connects the input cluster of vertices.
Circle([origin, radius, direction, ...])Creates a single closed circular Edge.
Connection(edgeA, edgeB[, tolerance, silent])Returns the shortest straight Edge connecting the two input Edges.
Direction(edge[, mantissa, tolerance, silent])Returns the unit chord direction of the input edge.
Ellipse([origin, inputMode, width, length, ...])Creates one exact elliptical Edge over the requested angular interval.
EndVertex(edge[, silent])Returns the end vertex of the input edge.
Equation2D(edge[, mantissa])Returns the 2D equation of the input edge.
Extend(edge[, distance, bothSides, reverse, ...])Extends a geometrically linear edge by the input distance.
ExtendToEdge(edgeA, edgeB[, mantissa, step, ...])Extends edgeA with a straight tangent continuation until it meets edgeB.
ExternalBoundary(edge[, tolerance, silent])Returns the external boundary (cluster of end vertices) of the input edge.
GoldenSpiral([width, maxIterations, ...])Creates one exact golden-rectangle spiral Edge.
Helix([origin, radius, height, turns, ...])Creates a single smooth helical Edge.
Hyperbola([a, b, fromParameter, ...])Creates a single exact hyperbolic Edge.
Index(edges[, strict, tolerance])Returns index of the input edge in the input list of edges
Intersect2D(edgeA, edgeB[, silent, ...])Returns the intersection vertex of the two input edges.
IsClosed(edge[, tolerance, silent])Returns True if the input edge is closed.
IsCollinear(edgeA, edgeB[, mantissa, tolerance])Return True if the two input edges are collinear.
IsCoplanar(edgeA, edgeB[, mantissa, tolerance])Return True if the two input edges are coplanar.
IsLinear(edge[, tolerance, silent])Returns True if the input edge is geometrically linear.
IsParallel(edgeA, edgeB[, mantissa, tolerance])Return True if the two input edges are parallel.
Length(edge[, mantissa, tolerance, silent])Returns the geometric length of the input edge.
Line([origin, length, direction, placement, ...])Creates a straight edge (line) using the input parameters.
Normal([angle, tolerance, silent])Returns a deterministic unit normal at the midpoint of the actual edge curve.
NormalAtParameter(edge[, u, angle, ...])Returns a deterministic unit normal vector to the actual edge curve.
NormalEdge(edge[, length, u, angle, ...])Creates a straight edge along the local normal of the actual input curve at parameter
u.Normalize(edge[, useEndVertex, tolerance, ...])Returns a geometrically linear edge of unit length.
Parabola([origin, focalLength, ...])Creates a single exact parabolic Edge.
ParameterAtVertex(vertex[, mantissa, ...])Returns the normalized curve parameter of a vertex lying on the input edge.
Quadrance(edge[, mantissa])Returns the quadrance of the input edge.
Reverse(edge[, tolerance, silent])Creates an edge with the reverse orientation of the input edge.
SetLength(edge[, length, bothSides, ...])Returns a geometrically linear edge with the requested length.
Spiral([origin, radiusA, radiusB, height, ...])Creates one smooth cubic B-spline Edge approximating an Archimedean spatial spiral.
Spread(edgeA, edgeB[, mantissa, bracket])Returns the spread between the two input edges.
Squircle([origin, radius, a, b, direction, ...])Creates one closed cubic B-spline Edge approximating a squircle/superellipse.
StartVertex(edge[, silent])Returns the start vertex of the input edge.
TangentAtParameter(edge[, u, mantissa, ...])Returns the unit tangent vector to the actual edge curve at normalized parameter u.
Trim(edge[, distance, bothSides, reverse, ...])Trims the input edge by a geometric distance while preserving its geometry.
TrimByEdge(edgeA, edgeB[, reverse, ...])Trims edgeA at its intersection with edgeB while preserving the exact geometry and direction of edgeA.
TrimByParameters(edge[, uA, uB, tolerance, ...])Returns the portion of the input edge between two normalized curve parameters.
VertexByDistance(edge[, distance, origin, ...])Returns a vertex at signed curvilinear distance from an origin on an edge.
VertexByParameter(edge[, u, tolerance, silent])Creates a vertex at normalized parameter u on the actual edge curve.
Vertices(edge[, silent])Returns the list of vertices of the input edge.
- static Align2D(edgeA, edgeB)
Compute the 4x4 transformation matrix to fully align edgeA to edgeB.
- Parameters:
edge1 (Edge): The source 2D edge to transform. edge2 (Edge): The target 2D edge.
- Returns:
list: A 4x4 transformation matrix.
- static Angle(edgeA, edgeB, mantissa: int = 6, bracket: bool = False) float
Returns the angle in degrees between the two input edges.
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic Edge
The second input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- bracketbool
If set to True, the returned angle is bracketed between 0 and 180. Default is False.
- Returns
- float
The angle in degrees between the two input edges.
- static Arc(origin=None, radius: float = 0.5, fromAngle: float = 0.0, toAngle: float = 180.0, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates a single open circular arc Edge.
The arc is constructed as an exact curve rather than as a polyline approximation. Angles are measured in degrees counter-clockwise from the positive local X-axis when viewed along the positive local Z-axis.
The input direction defines the normal of the plane containing the arc. The resulting topology is always a single open Edge. A complete 360-degree circle cannot be created using this method.
- Parameters
- origintopologic_core.Vertex , optional
The placement origin of the arc. If None, the global origin is used. The interpretation of the origin depends on the input placement parameter. Default is None.
- radiusfloat , optional
The radius of the arc. Default is 0.5.
- fromAnglefloat , optional
The angle in degrees at which the arc starts. Default is 0.0.
- toAnglefloat , optional
The angle in degrees at which the arc ends. If this value is less than fromAngle, 360 degrees are added until a positive counter-clockwise sweep is obtained. The resulting sweep must be greater than zero and less than 360 degrees. Default is 180.0.
- directionlist , optional
The vector representing the normal to the plane of the arc. Default is [0, 0, 1].
- placementstr , optional
The placement of the input origin relative to the arc. The options are “center”, “start”, and “end”. If set to “center”, the centre of the underlying circle is placed at the origin. If set to “start”, the start vertex of the arc is placed at the origin. If set to “end”, the end vertex of the arc is placed at the origin. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created open circular arc.
- static ArcByVertices(startVertex, middleVertex, endVertex, tolerance: float = 0.0001, silent: bool = False)
Creates one exact circular arc Edge through three input vertices.
- Parameters
- startVertextopologic_core.Vertex
The start vertex of the arc.
- middleVertextopologic_core.Vertex
A vertex that lies on the desired arc between start and end.
- endVertextopologic_core.Vertex
The end vertex of the arc.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The exact circular arc Edge, or None if the three vertices are invalid or collinear.
- static Bezier(controlPoints, weights=None, tolerance: float = 0.0001, silent: bool = False)
Creates a single exact Bezier curve Edge.
The Bezier curve is represented as a clamped B-spline/NURBS curve. If weights are supplied, a rational Bezier curve is created; otherwise a non-rational Bezier curve is created. The degree is one less than the number of control points.
- Parameters
- controlPointslist
The control vertices of the Bezier curve. At least two valid vertices must be supplied.
- weightslist , optional
One finite positive weight per control point. If supplied, a rational Bezier curve is created. Default is None.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created Bezier Edge, or None if the curve cannot be created.
- static Bisect(edgeA, edgeB, length: float = 1.0, placement: int = 0, tolerance: float = 0.0001, silent: bool = False)
Creates a bisecting edge between edgeA and edgeB.
- Parameters
- edgeAtopologic_core.Edge
The first topologic Edge.
- edgeBtopologic Edge
The second topologic Edge.
- lengthfloat , optional
The desired length of the bisecting edge. Default is 1.0.
- placementint , optional
The desired placement of the bisecting edge. If set to 0, the bisecting edge centroid will be placed at the end vertex of the first edge. If set to 1, the bisecting edge start vertex will be placed at the end vertex of the first edge. If set to 2, the bisecting edge end vertex will be placed at the end vertex of the first edge. If set to any number other than 0, 1, or 2, the bisecting edge centroid will be placed at the end vertex of the first edge. Default is 0.
- tolerancefloat , optional
The desired tolerance to decide if an Edge can be created. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created bisecting edge.
- static ByCurve(controlPoints, degree: int = 3, isPeriodic: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a non-rational B-spline edge using the input vertices as control points.
This is a convenience wrapper around
Edge.ByNurbsParameters(). The curve is not a polyline: it remains one topological Edge backed by one continuous B-spline curve.
- static ByFaceNormal(face, origin=None, length: float = 1.0, tolerance: float = 0.0001)
Creates a straight edge representing the normal to the input face.
- Parameters
- facetopologic_core.Face
The input face
- origintopologic_core.Vertex , optional
The desired origin of the edge. If set to None, the centroid of the face is chosen as the origin of the edge. Default is None.
- lengthfloat , optional
The desired length of the edge. Default is 1.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- edgetopologic_core.Edge
The created edge.
- static ByNurbsParameters(controlPoints, weights=None, knots=None, isRational: bool = False, isPeriodic: bool = False, degree: int = 3, tolerance: float = 0.0001, silent: bool = False)
Creates an edge from exact NURBS/B-spline parameters.
- Parameters
- controlPointslist
The control vertices (poles) of the curve.
- weightslist , optional
One positive weight per control point. If None, all weights are 1.0.
- knotslist , optional
Expanded nondecreasing knot vector. Repeated knots are repeated in the list. If None, a uniform expanded knot vector is generated.
- isRationalbool , optional
If True, construct a rational NURBS curve. Default is False.
- isPeriodicbool , optional
If True, request a periodic B-spline/NURBS curve. Default is False.
- degreeint , optional
Curve degree. Default is 3.
- tolerancefloat , optional
Geometric tolerance used for input validation. Default is 0.0001.
- silentbool , optional
If True, suppress diagnostics. Default is False.
- Returns
- topologic_core.Edge
The created edge, or None on failure.
- static ByOffset2D(edge, offset: float = 1.0, tolerance: float = 0.0001, silent: bool = False)
Creates a single Edge offset from the input Edge in the XY plane.
Positive offsets are to the left of the Edge when travelling from its start Vertex to its end Vertex. Negative offsets are to the right.
The input Edge must lie in a plane parallel to the XY plane. Curved, B-Spline, NURBS, circular, and other supported curve geometry is preserved by a backend-native offset operation when available.
- Parameters
- edgetopologic_core.Edge
The input Edge.
- offsetfloat , optional
The desired signed offset distance. Positive values offset to the left of the Edge direction and negative values offset to the right. Default is 1.0.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
A single offset Edge.
- static ByOriginDirectionLength(origin=None, direction=[0, 0, 1], length: float = 1.0, tolerance: float = 0.0001, silent: bool = False)
Creates a straight edge from the input parameters.
- Parameters
- origintopologic_core.Vertex
The origin (start vertex) of the edge.
- directionlist , optional
The desired direction vector of the edge. Default is [0,0,1] (pointing up in the Z direction)
- length: float , optional
The desired length of edge. Default is 1.0.
- tolerancefloat , optional
The desired tolerance to decide if an edge can be created. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created edge.
- static ByStartVertexEndVertex(vertexA, vertexB, tolerance: float = 0.0001, silent=False)
Creates a straight edge that connects the input vertices.
- Parameters
- vertexAtopologic_core.Vertex
The first input vertex. This is considered the start vertex.
- vertexBtopologic_core.Vertex
The second input vertex. This is considered the end vertex.
- tolerancefloat , optional
The desired tolerance to decide if an Edge can be created. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- edgetopologic_core.Edge
The created edge.
- static ByVertices(*vertices, tolerance: float = 0.0001, silent: bool = False)
Creates a straight edge that connects the input list of vertices.
- Parameters
- verticeslist
The input list of vertices. The first item is considered the start vertex and the last item is considered the end vertex.
- tolerancefloat , optional
The desired tolerance to decide if an edge can be created. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created edge.
- static ByVerticesCluster(cluster, tolerance: float = 0.0001)
Creates a straight edge that connects the input cluster of vertices.
- Parameters
- clustertopologic_core.Cluster
The input cluster of vertices. The first item is considered the start vertex and the last item is considered the end vertex.
- tolerancefloat , optional
The desired tolerance to decide if an edge can be created. Default is 0.0001.
- Returns
- topologic_core.Edge
The created edge.
- static Circle(origin=None, radius: float = 0.5, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates a single closed circular Edge.
The circle is constructed as an exact closed curve rather than as a polyline approximation. It is initially defined in a local XY plane and oriented such that its positive local Z-axis aligns with the input direction.
The seam of the closed Edge is located on the positive local X-axis.
- Parameters
- origintopologic_core.Vertex , optional
The placement origin of the circle. If None, the global origin is used. The interpretation of this origin depends on the input placement parameter. Default is None.
- radiusfloat , optional
The radius of the circle. Default is 0.5.
- directionlist , optional
The vector representing the normal to the plane of the circle. Default is [0, 0, 1].
- placementstr , optional
The placement of the input origin relative to the circle. The options are “center”, “lowerleft”, “upperleft”, “lowerright”, and “upperright”. These correspond to the centre or a corner of the circle’s local bounding square. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created closed circular Edge.
- static Connection(edgeA, edgeB, tolerance: float = 0.0001, silent: bool = False)
Returns the shortest straight Edge connecting the two input Edges.
When the active backend provides a native connection operation, closest points are computed from the complete edge geometries. This is important for curved Edges because the closest points need not be endpoint vertices. For backends without a native connection operation, the historical closest-endpoint construction is retained as a compatibility fallback.
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic_core.Edge
The second input edge.
- tolerancefloat , optional
The desired tolerance. If the minimum separation is less than or equal to this value, None is returned. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The shortest connecting Edge, or None if the input Edges intersect, touch within tolerance, or a connection cannot be created.
- static Direction(edge, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) list
Returns the unit chord direction of the input edge.
For a curved edge, the direction is defined by the vector from its oriented start vertex to its oriented end vertex. It is therefore a global chord direction rather than a local curve tangent. A closed edge has a degenerate chord and therefore has no global chord direction.
- Parameters
- edgetopologic_core.Edge
The input edge.
- mantissaint , optional
The number of decimal places to round the result to. If None, full available precision is returned. Default is 6.
- tolerancefloat , optional
The desired tolerance used to detect a degenerate chord. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The unit chord direction of the input edge, or None if the chord is degenerate.
- static Ellipse(origin=None, inputMode: int = 1, width: float = 2.0, length: float = 1.0, focalLength: float = 0.866025, eccentricity: float = 0.866025, majorAxisLength: float = 1.0, minorAxisLength: float = 0.5, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates one exact elliptical Edge over the requested angular interval.
A complete 360-degree ellipse is returned as one closed rational quadratic NURBS Edge. A partial ellipse is returned as one open exact rational quadratic NURBS Edge. Angles are measured counter-clockwise from the positive local X-axis.
- Parameters
- origintopologic_core.Vertex , optional
The placement origin. Default is the global origin.
- inputModeint , optional
1 = width/length, 2 = focalLength/eccentricity, 3 = focalLength/minorAxisLength, 4 = majorAxisLength/minorAxisLength.
- widthfloat , optional
Full local X width for mode 1. Default is 2.0.
- lengthfloat , optional
Full local Y length for mode 1. Default is 1.0.
- focalLengthfloat , optional
Focal length for modes 2 and 3. Default is 0.866025.
- eccentricityfloat , optional
Eccentricity for mode 2. Default is 0.866025.
- majorAxisLengthfloat , optional
Historical semi-axis input for mode 4. Default is 1.0.
- minorAxisLengthfloat , optional
Historical semi-axis input for modes 3 and 4. Default is 0.5.
- fromAnglefloat , optional
Start angle in degrees. Default is 0.
- toAnglefloat , optional
End angle in degrees. Values below fromAngle are advanced by 360 degrees. The sweep must be greater than zero and no greater than 360 degrees.
- directionlist , optional
Ellipse-plane normal. Default is [0, 0, 1].
- placementstr , optional
“center” or “lowerleft”. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The exact elliptical Edge.
- static EndVertex(edge, silent: bool = False)
Returns the end vertex of the input edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The end vertex of the input edge.
- static Equation2D(edge, mantissa=6)
Returns the 2D equation of the input edge. This is assumed to be in the XY plane.
- Parameters
- edgetopologic_core.Edge
The input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- dict
The equation of the edge stored in a dictionary. The dictionary has the following keys: “slope”: The slope of the line. This can be float(‘inf’) “x_intercept”: The X axis intercept. This can be None. “y_intercept”: The Y axis intercept. This can be None.
- static Extend(edge, distance: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001, silent: bool = False)
Extends a geometrically linear edge by the input distance.
This method is intended only for geometrically linear edges. Curved edges are not modified and will cause the method to return None.
If bothSides is True, half of the input distance is added to each end of the edge. Otherwise, the end vertex is extended unless reverse is True, in which case the start vertex is extended. The dictionary of the input edge is transferred to the returned edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- distancefloat , optional
The total distance by which to extend the edge. Default is 1.0.
- bothSidesbool , optional
If set to True, the extension is distributed equally between both ends. Default is True.
- reversebool , optional
If bothSides is False and reverse is True, extend the start vertex. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The extended edge, or None if the operation cannot be completed.
- static ExtendToEdge(edgeA, edgeB, mantissa: int = 6, step: bool = True, tolerance: float = 0.0001, silent: bool = False)
Extends edgeA with a straight tangent continuation until it meets edgeB.
For a linear edgeA, the resulting Edge remains linear.
For a curved edgeA, the extension leaves the selected endpoint along the tangent to edgeA at that endpoint. The original curve and the straight extension are concatenated into one single Edge by the active backend.
Both endpoints of edgeA are considered. If one or both outward tangent rays intersect edgeB, the shortest valid extension is selected. If a ray intersects edgeB at multiple points, the intersection closest to the corresponding endpoint of edgeA is selected.
The original direction of edgeA is preserved.
- Parameters
- edgeAtopologic_core.Edge
The Edge to extend.
- edgeBtopologic_core.Edge
The target Edge.
- mantissaint , optional
Retained for backward API compatibility. Default is 6.
- stepbool , optional
Retained for backward API compatibility. Default is True.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If True, suppress diagnostic messages. Default is False.
- Returns
- topologic_core.Edge
One extended Edge, or None if the operation cannot be completed.
- static ExternalBoundary(edge, tolerance: float = 0.0001, silent: bool = False)
Returns the external boundary (cluster of end vertices) of the input edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Cluster
The external boundary of the input edge. This is a cluster of the edge’s end vertices.
- static GoldenSpiral(width: float = 1.0, maxIterations: int = 10, clockwise: bool = False, origin=None, placement: str = 'center', direction: list = [0, 0, 1], mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Creates one exact golden-rectangle spiral Edge.
The geometry is the traditional golden-rectangle construction composed of quarter-circle arcs. All quarter-circle spans are stored in one rational quadratic NURBS Edge, so the result is a single topological Edge and each circular span is geometrically exact.
- static Helix(origin=None, radius: float = 0.5, height: float = 1.0, turns: float = 1.0, sides: int = 16, clockwise: bool = False, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates a single smooth helical Edge.
The helix is represented as one cubic B-spline Edge composed internally of tangent-matched cubic Bezier spans. The curve closely approximates the analytic circular helix while remaining one topological Edge.
Unlike circles, ellipses, parabolas, and hyperbolas, a circular helix does not have an exact finite NURBS representation.
In its canonical orientation, the helix has its axis along the positive Z-axis and starts at (radius, 0, 0).
- Parameters
- origintopologic_core.Vertex , optional
The placement origin. If None, the global origin is used. Default is None.
- radiusfloat , optional
The radius of the helix. Default is 0.5.
- heightfloat , optional
The total height of the helix measured along its axis. Default is 1.0.
- turnsfloat , optional
The number of complete turns. Fractional turns are permitted. Default is 1.0.
- sidesint , optional
The number of cubic curve spans per complete turn. Increasing this value improves geometric accuracy without increasing the number of topological Edges. Default is 16.
- clockwisebool , optional
If set to True, the helix rotates clockwise when viewed along its positive axis. Otherwise, it rotates counter-clockwise. Default is False.
- directionlist , optional
The direction of the helix axis. Default is [0, 0, 1].
- placementstr , optional
Specifies which canonical location is placed at the input origin. Valid options are “center”, “base”, “bottom”, “start”, and “end”. “base” and “bottom” refer to the centre of the base circle. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created helical Edge, or None if it cannot be created.
- Hyperbola(a: float = 1.0, b: float = 0.5, fromParameter: float = -1.0, toParameter: float = 1.0, branch: str = 'right', direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates a single exact hyperbolic Edge.
In its canonical orientation, the hyperbola lies in the XY plane and is defined by:
x^2 / a^2 - y^2 / b^2 = 1
The right branch is parametrically defined by:
x = a*cosh(u) y = b*sinh(u)
and the left branch is its reflection across the Y-axis.
The resulting curve is represented exactly as a rational quadratic Bezier/NURBS curve.
- Parameters
- origintopologic_core.Vertex , optional
The placement origin. If None, the global origin is used. Default is None.
- afloat , optional
The semi-transverse axis length. Default is 1.0.
- bfloat , optional
The semi-conjugate axis length. Default is 0.5.
- fromParameterfloat , optional
The starting hyperbolic parameter. Default is -1.0.
- toParameterfloat , optional
The ending hyperbolic parameter. Default is 1.0.
- branchstr , optional
The branch of the hyperbola. Valid options are “right” and “left”. Default is “right”.
- directionlist , optional
The normal vector of the plane containing the hyperbola. Default is [0, 0, 1].
- placementstr , optional
Specifies which canonical location is placed at the input origin. Valid options are “center”, “vertex”, “start”, and “end”. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created exact hyperbolic Edge, or None if it cannot be created.
- Index(edges: list, strict: bool = False, tolerance: float = 0.0001) int
Returns index of the input edge in the input list of edges
- Parameters
- edgetopologic_core.Edge
The input edge.
- edgeslist
The input list of edges.
- strictbool , optional
If set to True, the edge must be strictly identical to the one found in the list. Otherwise, a distance comparison is used. Default is False.
- tolerancefloat , optional
The tolerance for computing if the input edge is identical to an edge from the list. Default is 0.0001.
- Returns
- int
The index of the input edge in the input list of edges.
- static Intersect2D(edgeA, edgeB, silent: bool = False, mantissa: int = 6, tolerance: float = 0.0001)
Returns the intersection vertex of the two input edges. This is assumed to be in the XY plane. The intersection vertex does not necessarily fall within the extents of either edge.
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic_core.Edge
The second input edge.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- topologic_core.Vertex
The intersection vertex or None if the edges are parallel or collinear.
- static IsClosed(edge, tolerance: float = 0.0001, silent: bool = False) bool
Returns True if the input edge is closed. Returns False otherwise.
A closed edge has no distinct topological start and end boundary. Native backend closure detection is preferred when available. If the active backend does not expose such a query, closure is determined from the start and end vertices.
- Parameters
- edgetopologic_core.Edge
The input edge.
- tolerancefloat , optional
The desired tolerance used by the fallback closure test. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the input edge is closed. False otherwise.
- static IsCollinear(edgeA, edgeB, mantissa: int = 6, tolerance: float = 0.0001)
Return True if the two input edges are collinear. Returns False otherwise. This code is based on a contribution by https://github.com/gaoxipeng
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic_core.Edge
The second input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- bool
True if the two edges are collinear. False otherwise.
- static IsCoplanar(edgeA, edgeB, mantissa: int = 6, tolerance: float = 0.0001)
Return True if the two input edges are coplanar. Returns False otherwise.
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic_core.Edge
The second input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- bool
True if the two edges are coplanar. False otherwise.
- static IsLinear(edge, tolerance: float = 0.0001, silent: bool = False) bool
Returns True if the input edge is geometrically linear. Returns False otherwise.
An edge is considered linear if its actual geometry follows one straight segment within the specified tolerance. Native backend classification is preferred. If unavailable, the method compares the exact edge length with the Euclidean distance between its endpoints.
- Parameters
- edgetopologic_core.Edge
The input edge.
- tolerancefloat , optional
The desired tolerance used to determine if the edge is geometrically linear. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the input edge is geometrically linear. False otherwise.
- static IsParallel(edgeA, edgeB, mantissa: int = 6, tolerance: float = 0.0001)
Return True if the two input edges are parallel. Returns False otherwise.
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic_core.Edge
The second input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- bool
True if the two edges are collinear. False otherwise.
- static Length(edge, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) float
Returns the geometric length of the input edge.
The length is evaluated by the active backend from the actual edge curve, not from the start-to-end chord.
- Parameters
- edgetopologic_core.Edge
The input edge.
- mantissaint , optional
The number of decimal places to round the result to. If None, full available precision is returned. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- float
The geometric length of the input edge.
- static Line(origin=None, length: float = 1, direction: list = [1, 0, 0], placement: str = 'center', tolerance: float = 0.0001)
Creates a straight edge (line) using the input parameters.
- Parameters
- origintopologic_core.Vertex , optional
The origin location of the box. Default is None which results in the edge being placed at (0, 0, 0).
- lengthfloat , optional
The desired length of the edge. Default is 1.0.
- directionlist , optional
The desired direction (vector) of the edge. Default is [1,0,0] (along the X-axis).
- placementstr , optional
The desired placement of the edge. The options are: 1. “center” which places the center of the edge at the origin. 2. “start” which places the start of the edge at the origin. 3. “end” which places the end of the edge at the origin. The default is “center”. It is case insensitive.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- ——-
- topologic_core.Edge
The created edge
- Normal(angle: float = 0.0, tolerance: float = 0.0001, silent: bool = False)
Returns a deterministic unit normal at the midpoint of the actual edge curve.
- static NormalAtParameter(edge, u: float = 0.5, angle: float = 0.0, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) list
Returns a deterministic unit normal vector to the actual edge curve.
For a genuinely curved edge, the principal normal supplied by the active backend is used when defined. For a straight edge, or at zero curvature, the historical TopologicPy transverse-normal convention is used: an XY edge receives its left-hand in-plane normal.
anglerotates the normal about the local tangent.
- static NormalEdge(edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0, tolerance: float = 0.0001, silent: bool = False)
Creates a straight edge along the local normal of the actual input curve at parameter
u.
- static Normalize(edge, useEndVertex: bool = False, tolerance: float = 0.0001, silent: bool = False)
Returns a geometrically linear edge of unit length.
This method is intended only for geometrically linear edges. Curved edges are not modified and will cause the method to return None.
By default, the start vertex of the input edge remains fixed. If useEndVertex is True, the end vertex remains fixed instead.
- Parameters
- edgetopologic_core.Edge
The input edge.
- useEndVertexbool , optional
If set to False, the start vertex remains fixed. If set to True, the end vertex remains fixed. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
A unit-length edge, or None if the input edge is curved or the operation cannot be completed.
- static Parabola(origin=None, focalLength: float = 0.5, fromParameter: float = -1.0, toParameter: float = 1.0, direction: list = [0, 0, 1], placement: str = 'vertex', tolerance: float = 0.0001, silent: bool = False)
Creates a single exact parabolic Edge.
In its canonical orientation, the parabola lies in the XY plane, has its vertex at the global origin, opens in the positive Y direction, and is defined parametrically by:
x = 2*f*t y = f*t^2
where f is the focal length and t is the curve parameter.
The resulting parabola is represented exactly as a quadratic Bezier curve.
- Parameters
- origintopologic_core.Vertex , optional
The placement origin of the parabola. If None, the global origin is used. Default is None.
- focalLengthfloat , optional
The focal length of the parabola. Default is 0.5.
- fromParameterfloat , optional
The starting parametric value. Default is -1.0.
- toParameterfloat , optional
The ending parametric value. Default is 1.0.
- directionlist , optional
The normal vector of the plane containing the parabola. Default is [0, 0, 1].
- placementstr , optional
Specifies which canonical point is placed at the input origin. The options are “vertex”, “start”, and “end”. Default is “vertex”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The created exact parabolic Edge, or None if it cannot be created.
- ParameterAtVertex(vertex, mantissa: int = 6, silent: bool = False, tolerance: float = 0.0001) float
Returns the normalized curve parameter of a vertex lying on the input edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- vertextopologic_core.Vertex
The input vertex.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- tolerancefloat , optional
The desired tolerance used to determine whether the vertex lies on the edge. Default is 0.0001.
- Returns
- float
The normalized parameter in the range [0, 1], or None if the vertex is not on the edge.
- static Quadrance(edge, mantissa: int = 6) float
Returns the quadrance of the input edge. See: https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- Parameters
- edgetopologic_core.Edge
The input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- float
The quadrance of the input edge.
- static Reverse(edge, tolerance: float = 0.0001, silent: bool = False)
Creates an edge with the reverse orientation of the input edge.
The geometry of the input edge is preserved. Native backend reversal is preferred. Endpoint reconstruction is permitted only for a geometrically linear edge when no native reversal exists. The input dictionary is retained.
- Parameters
- edgetopologic_core.Edge
The input edge.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The reversed edge, or None if reversal cannot be performed without altering its geometry.
- static SetLength(edge, length: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001, silent: bool = False)
Returns a geometrically linear edge with the requested length.
This method is intended only for geometrically linear edges. Curved edges are not modified and will cause the method to return None. The input edge dictionary is transferred to the returned edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- lengthfloat , optional
The desired length of the returned edge. Default is 1.0.
- bothSidesbool , optional
If True, preserve the midpoint. Default is True.
- reversebool , optional
If bothSides is False and reverse is True, preserve the end vertex; otherwise preserve the start vertex. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The resized edge, or None if the operation cannot be completed.
- static Spiral(origin=None, radiusA: float = 0.05, radiusB: float = 0.5, height: float = 1.0, turns: int = 10, clockwise: bool = False, reverse: bool = False, direction: list = [0, 0, 1], placement: str = 'center', segmentsPerTurn: int = 12, tolerance: float = 0.0001, silent: bool = False)
Creates one smooth cubic B-spline Edge approximating an Archimedean spatial spiral.
segmentsPerTurncontrols the internal cubic approximation only. It does not create multiple topological Edges; the result is always one Edge.
- static Spread(edgeA, edgeB, mantissa: int = 6, bracket: bool = False) float
Returns the spread between the two input edges.
- Spread is the rational trigonometry equivalent of angle and is defined as:
spread = sin^2(theta)
spread = 0 : edges are parallel
spread = 1 : edges are perpendicular
0 <= spread <= 1
No trigonometric functions are used
- Parameters
- edgeAtopologic_core.Edge
The first input edge.
- edgeBtopologic_core.Edge
The second input edge.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- bracketbool
If set to True, the spread is bracketed to represent the acute case (i.e. invariant under edge reversal). Default is False.
- Returns
- float
The spread between the two input edges.
- static Squircle(origin=None, radius: float = 0.5, a: float = 2.0, b: float = 2.0, direction: list = [0, 0, 1], placement: str = 'center', segments: int = 32, tolerance: float = 0.0001, silent: bool = False)
Creates one closed cubic B-spline Edge approximating a squircle/superellipse.
segmentscontrols the internal cubic approximation only. The result is always one topological Edge. Whena == b == 1an exact circular Edge is returned instead.
- static StartVertex(edge, silent: bool = False)
Returns the start vertex of the input edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The start vertex of the input edge.
- static TangentAtParameter(edge, u: float = 0.5, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) list
Returns the unit tangent vector to the actual edge curve at normalized parameter u.
- Parameters
- edgetopologic_core.Edge
The input edge.
- ufloat , optional
The normalized parameter along the edge. Default is 0.5.
- mantissaint , optional
The number of decimal places to round the result to. If set to None, no rounding is applied. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The unit tangent vector [x, y, z], or None if it cannot be evaluated.
- static Trim(edge, distance: float = 0.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001, silent: bool = False)
Trims the input edge by a geometric distance while preserving its geometry.
The input distance represents the total amount removed from the edge. If bothSides is True, half of the distance is removed from each end. Otherwise, the distance is removed from the end of the edge unless reverse is True, in which case it is removed from the start.
For curved edges, distances are measured along the actual curve rather than along the chord between its endpoints. The underlying curve geometry is preserved. If the active backend cannot trim a curved edge exactly, None is returned rather than replacing or approximating the curve.
- Parameters
- edgetopologic_core.Edge
The input edge.
- distancefloat , optional
The total geometric distance to remove from the edge. Negative values are treated as positive. Default is 0.0.
- bothSidesbool , optional
If set to True, half of the input distance is removed from each end of the edge. Default is True.
- reversebool , optional
If bothSides is False and reverse is True, the distance is removed from the start of the edge instead of the end. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The trimmed edge, or None if the operation cannot be completed without altering the curve geometry.
- static TrimByEdge(edgeA, edgeB, reverse: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Trims edgeA at its intersection with edgeB while preserving the exact geometry and direction of edgeA.
If multiple internal intersections exist, the first intersection encountered from the start of edgeA is used when reverse is False. When reverse is True, the last intersection encountered from the start of edgeA is used.
The returned Edge is created by trimming edgeA in its native parameter space. Curved, B-Spline, and NURBS geometry is therefore preserved and is never reconstructed from endpoint vertices.
- Parameters
- edgeAtopologic_core.Edge
The Edge to trim.
- edgeBtopologic_core.Edge
The Edge used as the trimming geometry.
- reversebool , optional
If False, retains the portion of edgeA from its start to the first intersection with edgeB. If True, retains the portion from the last intersection with edgeB to the end of edgeA. In both cases, the original direction of edgeA is preserved. Default is False.
- mantissaint , optional
Retained for backward API compatibility. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The trimmed Edge. If no usable internal intersection exists, the original edgeA is returned.
- static TrimByParameters(edge, uA: float = 0.0, uB: float = 1.0, tolerance: float = 0.0001, silent: bool = False)
Returns the portion of the input edge between two normalized curve parameters.
Parameters are normalized to the range [0, 1], where 0 is the start of the edge and 1 is the end. If
uAis greater thanuB, the returned edge is oriented fromuAtowarduB.The active backend’s native trimming operation is preferred so curved geometry is preserved exactly. If native trimming is unavailable, a geometrically linear edge is reconstructed exactly from its evaluated endpoints. Curved edges are never silently converted to line segments or approximated by this method.
- Parameters
- edgetopologic_core.Edge
The input edge.
- uAfloat , optional
The normalized parameter corresponding to the start of the returned edge. Default is 0.0.
- uBfloat , optional
The normalized parameter corresponding to the end of the returned edge. Default is 1.0.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge
The trimmed edge, or None if the operation fails.
- static VertexByDistance(edge, distance: float = 0.0, origin=None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns a vertex at signed curvilinear distance from an origin on an edge.
Native arc-length evaluation is preferred. Linear edges may be extended beyond their endpoints. Curved open edges are evaluated only within their actual finite domain. Closed edges wrap around their closed path.
- Parameters
- edgetopologic_core.Edge
The input edge.
- distancefloat , optional
Signed curvilinear distance measured in the orientation of the edge. Default is 0.0.
- origintopologic_core.Vertex , optional
A vertex lying on the edge from which distance is measured. If None, the start vertex is used. Default is None.
- mantissaint , optional
The number of decimal places to round returned coordinates to. If None, full available precision is returned. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The resulting vertex, or None if the requested position cannot be evaluated without extrapolating an open curved edge.
- static VertexByParameter(edge, u: float = 0.0, tolerance: float = 0.0001, silent: bool = False)
Creates a vertex at normalized parameter u on the actual edge curve.
- Parameters
- edgetopologic_core.Edge
The input edge.
- ufloat , optional
The normalized parameter along the edge. A parameter of 0 returns the start vertex and 1 returns the end vertex. Default is 0.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The created vertex, or None if the parameter cannot be evaluated.
- static Vertices(edge, silent: bool = False) list
Returns the list of vertices of the input edge.
- Parameters
- edgetopologic_core.Edge
The input edge.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of vertices.