Skip to content

Comparison

Canonical path: NemAll_Python_Geometry.Comparison

Utility class with methods for comparing two geometries with each other

AllPointsAreOneAxis staticmethod

AllPointsAreOneAxis(polyline: Polyline2D, tolerance: float) -> bool

Check if all points of polyline are on one straight line

Parameters:

  • polyline (Polyline2D) –

    Polyline

  • tolerance (float) –

    Tolerance

Returns:

  • bool

    Result of the check

Congruent overloaded staticmethod

Congruent(l1p1: Point2D, l1p2: Point2D, l2p1: Point2D, l2p2: Point2D) -> bool

Checks if four points belonging to two lines are congruent

Congruent in this case means, that the endpoints of both lines coincide. Their orientation is irrelevant.

Parameters:

  • l1p1 (Point2D) –

    the 1. point of the 1. line

  • l1p2 (Point2D) –

    the 2. point of the 1. line

  • l2p1 (Point2D) –

    the 1. point of the 2. line

  • l2p2 (Point2D) –

    the 2. point of the 2. line

Returns:

  • bool

    true if lines are congruent, otherwise false.

Congruent(l1: Line2D, l2: Line2D) -> bool

Checks if two 2D lines are congruent

Congruent in this case means, that the endpoints of both lines coincide. Their orientation is irrelevant.

Parameters:

  • l1 (Line2D) –

    the first line

  • l2 (Line2D) –

    the second line

Returns:

  • bool

    true if lines are congruent, otherwise false.

Examples:

>>> Comparison.Congruent(Line2D(0, 0, 1, 1), 
...                      Line2D(1, 1, 0, 0))
True

DeterminePosition overloaded staticmethod

DeterminePosition(
    geoObject: object, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to an object.

Parameters:

  • geoObject (object) –

    IGeometry

  • point (Point2D) –

    Point

  • tolerance (float) –

    tolerance (if distance < tolerance, point on object)

Returns:

DeterminePosition(
    line: Line2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 2D line.

Parameters:

  • line (Line2D) –

    2D line

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow

Examples:

>>> line = Line2D(0, 0, 2, 2)
>>> Comparison.DeterminePosition(line, Point2D(1, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(line, Point2D(0, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(line, Point2D(2, 2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point not located on the line:

>>> Comparison.DeterminePosition(line, Point2D(0.5, 1.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove
>>> Comparison.DeterminePosition(line, Point2D(1.5, 0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eBelow

Point located on the line extension but not on the line:

>>> Comparison.DeterminePosition(line, Point2D(3, 3), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eRight
>>> Comparison.DeterminePosition(line, Point2D(-1, -1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eLeft
DeterminePosition(
    axis: Axis2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 2D axis.

Parameters:

  • axis (Axis2D) –

    2D axis

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

Examples:

>>> axis = Axis2D(Point2D(0, 0), Vector2D(1,1))
>>> Comparison.DeterminePosition(axis, Point2D(1, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(axis, Point2D(0.5, 1.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove
>>> Comparison.DeterminePosition(axis, Point2D(1.5, 0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eBelow
DeterminePosition(
    polyline: Polyline2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 2D polyline. Returns position of point to the closest line of poly line

Parameters:

  • polyline (Polyline2D) –

    2D polyline

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow

Examples:

>>> polyline = Polyline2D([Point2D(0, 0), Point2D(1, 1), Point2D(2, 0)])
>>> Comparison.DeterminePosition(polyline, Point2D(0.7, 0.7), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(polyline, Point2D(0, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(polyline, Point2D(2, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point not located on the polyline:

>>> Comparison.DeterminePosition(polyline, Point2D(1.5, 0.6), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove
>>> Comparison.DeterminePosition(polyline, Point2D(1.5, 0.4), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eBelow

Point located on the extension of the first polyline segment, but not on the polyline:

>>> Comparison.DeterminePosition(polyline, Point2D(-1, -1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eLeft

Point located on the extension of the last polyline segment, but not on the polyline:

>>> Comparison.DeterminePosition(polyline, Point2D(3, -1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eRight
DeterminePosition(
    arc: Arc2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 2D arc.

Parameters:

  • arc (Arc2D) –

    2D arc

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow

Examples:

>>> arc = Arc2D(Point2D(0, 0), 1.0, 1.0, 0.0, 0.0, pi)
>>> Comparison.DeterminePosition(arc, Point2D(0, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(arc, Point2D(1, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(arc, Point2D(-1, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point not located on the arc:

>>> Comparison.DeterminePosition(arc, Point2D(0.8, 0.8), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eBelow
>>> Comparison.DeterminePosition(arc, Point2D(0.6, 0.6), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove

Point located on the extension of the arc, but not on the arc:

>>> Comparison.DeterminePosition(arc, Point2D(-sqrt(2)/2, -sqrt(2)/2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eRight

If the point is on the arc's extension and close to the start point, it is also considered to be on the right side:

>>> Comparison.DeterminePosition(arc, Point2D(sqrt(2)/2, -sqrt(2)/2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eRight
DeterminePosition(
    arc: Arc3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 3D arc.

Parameters:

  • arc (Arc3D) –

    3D arc

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow

DeterminePosition(
    clothoid: Clothoid2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 2D clothoid.

Parameters:

  • clothoid (Clothoid2D) –

    2D clothoid

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow

DeterminePosition(
    spline: Spline2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 2D spline.

Parameters:

  • spline (Spline2D) –

    2D spline

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow

Examples:

>>> spline = Spline2D([Point2D(0, 0), Point2D(1, 1), Point2D(2, 0)])
>>> Comparison.DeterminePosition(spline, Point2D(0.67853, 0.86160), 1e-5)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(spline, Point2D(0, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(spline, Point2D(2, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point located near the spline, but not on the spline:

>>> Comparison.DeterminePosition(spline, Point2D(1.6, 0.66), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove
>>> Comparison.DeterminePosition(spline, Point2D(1.6, 0.53), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eBelow

It's not being recognized, whether the point is on the spline extension. The result is always eOutside

>>> Comparison.DeterminePosition(spline, Point2D(2.5547001962, -0.8320502943), 1e-3)
NemAll_Python_Geometry.eComparisionResult.eOutside
DeterminePosition(
    polygon: Polygon2D, point: Point2D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a polygon 2D.

Parameters:

  • polygon (Polygon2D) –

    Polygon2D

  • point (Point2D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eInside(inside the polygon), eOutside, eOnElement (on one of the edges), eEqualToEndPoint or Unknown

Examples:

For square_1 with side length of 2.0 and lower left corner in the origin, determine the position of a point like:

>>> Comparison.DeterminePosition(square_1, Point2D(0.5, 0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eInside
>>> Comparison.DeterminePosition(square_1, Point2D(2.5, 0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside

Point located on one of the edges:

>>> Comparison.DeterminePosition(square_1, Point2D(2, 0.7), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement

Point located on one of the vertices:

>>> Comparison.DeterminePosition(square_1, Point2D(2.0, 2.0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint
DeterminePosition(polygon: Polygon2D, line: Line2D) -> eComparisionResult

Determine the relative position of a line to a polygon 2D.

Parameters:

Returns:

  • eComparisionResult

    eInside(inside the polygon), eOutside, eNotParallel(the line crosses the polygon), eOnElement (on one of the edges), or Unknown

Examples:

For square_1 with side length of 2.0 and lower left corner in the origin, determine the position of a line like:

>>> Comparison.DeterminePosition(square_1, Line2D(0.5, 0.5, 1.5, 1.5))
NemAll_Python_Geometry.eComparisionResult.eInside

Line located partially inside the square:

>>> Comparison.DeterminePosition(square_1, Line2D(0.5, 0.5, 2.5, 0.5))
NemAll_Python_Geometry.eComparisionResult.eNotParallel

Line located entirely outside the square:

>>> Comparison.DeterminePosition(square_1, Line2D(0.5, 2.5, 2.5, 3.5))
NemAll_Python_Geometry.eComparisionResult.eOutside

Line located on one of the edges (but not exceeding it):

>>> Comparison.DeterminePosition(square_1, Line2D(0.5, 2.0, 1.5, 2.0))
NemAll_Python_Geometry.eComparisionResult.eOnElement
DeterminePosition(
    line: Line3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 3D line

Parameters:

  • line (Line3D) –

    3D line

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement when between start and end points, eAbove when not on the line, eRight when on the positive line extension, eLeft when on negative line extension. Also eEqualToStartPoint, eEqualToEndPoint are possible.

Examples:

>>> line = Line3D(0, 0, 0, 1, 1, 1)
>>> Comparison.DeterminePosition(line, Point3D(0.5, 0.5, 0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(line, Point3D(0, 0, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(line, Point3D(1, 1, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point not located on the line:

>>> Comparison.DeterminePosition(line, Point3D(0.5, 0.5, 0.6), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove

Also point intuitevely located below the line is considered to be above it:

>>> Comparison.DeterminePosition(line, Point3D(0.5, 0.5, -1.4), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove

Point located on the line extension but not on the line:

>>> Comparison.DeterminePosition(line, Point3D(1.5, 1.5, 1.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eRight
>>> Comparison.DeterminePosition(line, Point3D(-0.5, -0.5, -0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eLeft
DeterminePosition(
    polyline: Polyline3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 3D polyline

Parameters:

  • polyline (Polyline3D) –

    3D polyline

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement when on any of the segments, eAbove when not. eRight when on the extension of the last segment, eLeft when on the extension of the first segment. Also eEqualToStartPoint, eEqualToEndPoint are possible.

Examples:

>>> polyline = Polyline3D([Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(2, 0, 2)])
>>> Comparison.DeterminePosition(polyline, Point3D(0.5, 0.5, 0.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(polyline, Point3D(0, 0, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(polyline, Point3D(2, 0, 2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point not located on the polyline:

>>> Comparison.DeterminePosition(polyline, Point3D(1.5, 2.5, 1.5), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eAbove

Point located on the extension of the first polyline segment, but not on the polyline:

>>> Comparison.DeterminePosition(polyline, Point3D(-1, -1, -1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eLeft

Point located on the extension of the last polyline segment, but not on the polyline:

>>> Comparison.DeterminePosition(polyline, Point3D(3, -1, 3), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eRight
DeterminePosition(phed: Polyhedron3D, point: Point3D) -> eComparisionResult

Determine the relative position of a point to a Polyhedron

Parameters:

Returns:

Examples:

When cube_1 has side length of 2.0, and lower left corner in the origin, determine the position of a point like:

>>> Comparison.DeterminePosition(cube_1, Point3D(1, 1, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eInside
>>> Comparison.DeterminePosition(cube_1, Point3D(3, 1, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside

Point located on one of the faces:

>>> Comparison.DeterminePosition(cube_1, Point3D(2, 1, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside

Point located on one of the edges:

>>> Comparison.DeterminePosition(cube_1, Point3D(2, 2, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside

Point located on one of the vertices:

>>> Comparison.DeterminePosition(cube_1, Point3D(2, 2, 2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eInside
DeterminePosition(
    spline: Spline3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a Spline3D

Parameters:

  • spline (Spline3D) –

    Spline3D

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eOutside

Examples:

>>> spline = Spline3D([Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(2, 0, 2)])
>>> Comparison.DeterminePosition(spline, Point3D(0.263135548200903, 0.3855935279515742, 0.2631355482009028), 1e-8)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(spline, Point3D(0, 0, 0), 1e-8)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(spline, Point3D(2, 0, 2), 1e-8)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point located near the spline, but not on the spline:

>>> Comparison.DeterminePosition(spline, Point3D(0.26, 0.38, 0.27), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside
DeterminePosition(
    spline: BSpline3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a BSpline3D

Parameters:

  • spline (BSpline3D) –

    BSpline3D

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eOutside

Examples:

When b_spline is a non-uniform, rational 2nd degree base spline with 3 control points in (0,0,0), (1,1,1) and (2,0,2), determine the position of a point like:

>>> Comparison.DeterminePosition(b_spline, Point3D(0.400283, 0.320170, 0.400283), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
>>> Comparison.DeterminePosition(b_spline, Point3D(0, 0, 0), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToStartPoint
>>> Comparison.DeterminePosition(b_spline, Point3D(2, 0, 2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eEqualToEndPoint

Point located near the spline, but not on the spline:

>>> Comparison.DeterminePosition(b_spline, Point3D(0.4, 0.3, 0.4), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside
DeterminePosition(
    path: Path3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a Path3D

Parameters:

  • path (Path3D) –

    Path3D

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eOutside

DeterminePosition(
    b: BRep3D, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 3D BRep

Parameters:

  • b (BRep3D) –

    BRep3D

  • point (Point3D) –

    Point

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • eComparisionResult

    eOnElement(identical to a vertex of the BRep), eInside (inside the BRep)

Examples:

When cylinder_1 is a cylinder with radius 1.0 and height 2.0, determine the position of a point like:

>>> Comparison.DeterminePosition(cylinder_1, Point3D(0, 0, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eInside
>>> Comparison.DeterminePosition(cylinder_1, Point3D(1, 1, 2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOutside

Point located on the cylinder's surface:

>>> Comparison.DeterminePosition(cylinder_1, Point3D(1, 0, 1), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eInside

Point located on one of the cylinder's vertices:

>>> Comparison.DeterminePosition(cylinder_1, Point3D(1, 0, 2), 1e-6)
NemAll_Python_Geometry.eComparisionResult.eOnElement
DeterminePosition(
    polygon1: Polygon2D, polygon2: Polygon2D
) -> eComparisionResult

Determine the relative position of the second polygon to the first polygon

Parameters:

Returns:

Examples:

When the first polygon is square_1 which has side length of 2.0 and lower left corner in the origin, determine the position of another square in relation to it like:

>>> Comparison.DeterminePosition(square_1, Polygon2D.CreateRectangle(Point2D(1, 1), Point2D(2, 2)))
NemAll_Python_Geometry.eComparisionResult.eInside

When the compared square is located partially outside the reference:

>>> Comparison.DeterminePosition(square_1, Polygon2D.CreateRectangle(Point2D(1.5, 1.5), Point2D(2.5, 2.5)))
NemAll_Python_Geometry.eComparisionResult.eCrossing

When the compared square is located entirely outside the reference:

>>> Comparison.DeterminePosition(square_1, Polygon2D.CreateRectangle(Point2D(2.5, 2.5), Point2D(3.5, 3.5)))
NemAll_Python_Geometry.eComparisionResult.eOutside

When the compared square is larger than the reference:

>>> Comparison.DeterminePosition(square_1, Polygon2D.CreateRectangle(Point2D(-0.5, -0.5), Point2D(2.5, 2.5)))
NemAll_Python_Geometry.eComparisionResult.eCrossing
DeterminePosition(line: Line2D, minMax: MinMax2D) -> eComparisionResult

Determine the relative position of minMax to line

Parameters:

Returns:

Examples:

>>> min_max = MinMax2D(Point2D(0, 0), Point2D(2, 2))

Line entirely inside the min-max box:

>>> Comparison.DeterminePosition(Line2D(0.5, 0.5, 1.5, 1.5), min_max)
NemAll_Python_Geometry.eComparisionResult.eCrossing

Line with start and end points outside the min-max box, but crossing it:

>>> Comparison.DeterminePosition(Line2D(0.5, 2.5, 2.5, 0.5), min_max)
NemAll_Python_Geometry.eComparisionResult.eCrossing

Line entirely outside the min-max box:

>>> Comparison.DeterminePosition(Line2D(3, 3, 4, 4), min_max)
NemAll_Python_Geometry.eComparisionResult.eOutside
DeterminePosition(lines: Line2DList, minMax: MinMax2D) -> eComparisionResult

Determine the relative position of the minMax to lines

Parameters:

Returns:

Examples:

line_list contains following lines:

>>> line_list
Line2D(0.5, 0.5, 1.5, 1.5)
Line2D(3, 3, 4, 4)

As soon as one line crosses the min-max box, the result is eCrossing:

>>> min_max = MinMax2D(Point2D(0, 0), Point2D(2, 2))
>>> Comparison.DeterminePosition(line_list, min_max)
NemAll_Python_Geometry.eComparisionResult.eCrossing
DeterminePosition(
    igeo: object, point: Point3D, tolerance: float
) -> eComparisionResult

Determine the relative position of a point to a 3D geometry

Parameters:

  • igeo (object) –

    3D geometry

  • point (Point3D) –

    Point3D

  • tolerance (float) –

    Absolute tolerance (if distance < tolerance, point on object). For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

DeterminePositionEx staticmethod

DeterminePositionEx(
    polyline: Polyline2D, point: Point2D, tolerance: float
) -> tuple[eComparisionResult, VecSizeTList]

Determine the relative position of a point to a 2D polyline.

Parameters:

  • polyline (Polyline2D) –

    2D polyline

  • point (Point2D) –

    Point

  • tolerance (float) –

    tolerance (if distance < tolerance, point on object)

Returns:

  • eComparisionResult

    Comparison result; eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, or eOutside

  • VecSizeTList

    Vector with polyline segment numbers, on which the point was found. Starting from 0.

Examples:

polyline_1 has three points: (0, 0), (1, 1), (2, 0)

Point on the first segment:

>>> Comparison.DeterminePositionEx(polyline_1, Point2D(0.5, 0.5), 1e-6)
(NemAll_Python_Geometry.eComparisionResult.eOnElement, 0
)

Point on the second segment:

>>> Comparison.DeterminePositionEx(polyline_1, Point2D(1.5, 0.5), 1e-6)
(NemAll_Python_Geometry.eComparisionResult.eOnElement, 1
)

Point outside the polyline:

>>> Comparison.DeterminePositionEx(polyline_1, Point2D(1.5, 1.5), 1e-6)
(NemAll_Python_Geometry.eComparisionResult.eOutside, )

Equal overloaded staticmethod

Equal(el1: float, el2: float) -> bool

Compare two floating point numbers with default relative tolerance.

The relative tolerance is calculated based on the maximum absolute value of the given numbers scaled by a factor 1e-11.

Parameters:

  • el1 (float) –

    first number

  • el2 (float) –

    second number

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For a number close to 1.0, the tolerance is close to 1e-11:

>>> Comparison.Equal(1, 1 + 2e-11)
True
>>> Comparison.Equal(1, 1 + 3e-11)
False

For a number close to 1e6:

>>> Comparison.Equal(1e6, 1e6 + 1e-5)
True
>>> Comparison.Equal(1e6, 1e6 + 2e-5)
False
Equal(el1: Point2D, el2: Point2D) -> bool

Compare two 2D points to determine if they can be considered equal. Use default tolerance.

This function checks if the absolute differences between the corresponding coordinates of two points el1 and el2 are within a default tolerance. Two points are considered equal, when the absolute difference is smaller than this tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set by the user in ALLPLAN settings (default 1e-2). The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 scaled by a factor 1e-11.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance is relevant:

>>> Comparison.Equal(Point2D(1, 1), 
...                  Point2D(1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.Equal(Point2D(1, 1), 
...                  Point2D(1 + 10e-3, 1 + 10e-3))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.Equal(Point2D(1e12 + 0, 1e12 + 0), 
...                  Point2D(1e12 + 9, 1e12 + 9))
True
>>> Comparison.Equal(Point2D(1e12 + 0,  1e12 + 0), 
...                  Point2D(1e12 + 10, 1e12 + 10))
False
Equal(el1: Point3D, el2: Point3D) -> bool

Compare two 3D points to determine if they can be considered equal. Use default tolerance.

This function checks if the absolute differences between the corresponding coordinates of two 3D points el1 and el2 are within a tolerance. Two points are considered equal, when the absolute difference is smaller than or equal to this tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set to 1e-3. The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 and el2 scaled by a factor 1e-9.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance of 1e-3 is relevant:

>>> Comparison.Equal(Point3D(1.00,  1.00,  1.00), 
...                  Point3D(1.001, 1.001, 1.001))
True
>>> Comparison.Equal(Point3D(1.00,  1.00,  1.00), 
...                  Point3D(1.002, 1.002, 1.002))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.Equal(Point3D(1e9 + 0, 1e9 + 0, 1e9 + 0), 
...                  Point3D(1e9 + 1, 1e9 + 1, 1e9 + 1))
True
>>> Comparison.Equal(Point3D(1e9 + 0, 1e9 + 0, 1e9 + 0), 
...                  Point3D(1e9 + 2, 1e9 + 2, 1e9 + 2))
False
Equal(el1: Vector2D, el2: Vector2D) -> bool

Compare two 2D vectors to determine if they can be considered equal. Use default tolerance.

This function checks if the absolute differences between the corresponding coordinates of two vectors el1 and el2 are within a default tolerance. They are considered equal, when the absolute difference is smaller than this tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set by the user in ALLPLAN settings (default 1e-2). The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 scaled by a factor 1e-11.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the absolute tolerance is relevant:

>>> Comparison.Equal(Vector2D(1, 1), 
...                  Vector2D(1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.Equal(Vector2D(1, 1), 
...                  Vector2D(1 + 10e-3, 1 + 10e-3))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.Equal(Vector2D(1e12 + 0, 1e12 + 0),
...                  Vector2D(1e12 + 9, 1e12 + 9))
True
>>> Comparison.Equal(Vector2D(1e12 + 0,  1e12 + 0), 
...                  Vector2D(1e12 + 10, 1e12 + 10))
False
Equal(el1: Vector3D, el2: Vector3D) -> bool

Compare two 3D vectors to determine if they can be considered equal. Use default tolerance.

This function checks if the absolute differences between the corresponding coordinates of two 3D vectors el1 and el2 are within a tolerance. They are considered equal, when the absolute difference is smaller than or equal to this tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set to 1e-3. The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 and el2 scaled by a factor 1e-9.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance of 1e-3 is relevant:

>>> Comparison.Equal(Vector3D(1.00,  1.00,  1.00), 
...                  Vector3D(1.001, 1.001, 1.001))
True
>>> Comparison.Equal(Vector3D(1.00,  1.00,  1.00), 
...                  Vector3D(1.002, 1.002, 1.002))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.Equal(Vector3D(1e9 + 0, 1e9 + 0, 1e9 + 0), 
...                  Vector3D(1e9 + 1, 1e9 + 1, 1e9 + 1))
True
>>> Comparison.Equal(Vector3D(1e9 + 0, 1e9 + 0, 1e9 + 0), 
...                  Vector3D(1e9 + 2, 1e9 + 2, 1e9 + 2))
False
Equal(el1: float, el2: float, tol: float) -> bool

Compare two floating point numbers with a given absolute tolerance.

Parameters:

  • el1 (float) –

    first number

  • el2 (float) –

    second number

  • tol (float) –

    The absolute tolerance used to compare the two numbers.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

>>> Comparison.Equal(1, 1 + 1e-5, 1e-5)
True
>>> Comparison.Equal(1, 1 + 2e-5, 1e-5)
False

The tolerance is absolute - it is not scaled by the maximum absolute value of the two numbers:

>>> Comparison.Equal(1e6, 1e6 + 1e-5, 1e-5)
True
>>> Comparison.Equal(1e6, 1e6 + 2e-5, 1e-5)
False
Equal(el1: Point2D, el2: Point2D, tol: float) -> bool

Compare two 2D points to determine if they can be considered equal.

This function checks if the absolute differences between the corresponding coordinates of two points el1 and el2 are within a tolerance. They are considered equal, when the absolute difference is smaller than the tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set by the user in ALLPLAN settings (default 1e-2). The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 scaled by the given factor tol.

Parameters:

  • el1 (Point2D) –

    first element

  • el2 (Point2D) –

    second element

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For coordinates close to 1.0, the calculated relative tolerance is the same as the tolerance factor tol:

>>> Comparison.Equal(Point2D(1.00,  1.00), 
...                  Point2D(1.009, 1.009), 1e-2)
True
>>> Comparison.Equal(Point2D(1.00, 1.00), 
...                  Point2D(1.01, 1.01), 1e-2)
False

For large coordinates, the tolerance increases:

>>> Comparison.Equal(Point2D(1e6 + 0,   1e6 + 0),
...                  Point2D(1e6 + 0.9, 1e6 + 0.9), 1e-6)
True
>>> Comparison.Equal(Point2D(1e6 + 0, 1e6 + 0),
...                  Point2D(1e6 + 1, 1e6 + 1), 1e-6)
False

For small coordinates, setting the tolerance factor to a small value does not have an effect, because the minimum absolute tolerance (set in ALLPLAN settings) becomes relevant:

>>> Comparison.Equal(Point2D(1.0, 1.0),
...                  Point2D(1.0 + 1e-3, 1.0 + 1e-3), 1e-6)
True
Equal(el1: Point3D, el2: Point3D, tol: float) -> bool

Compare two 3D points to determine if they can be considered equal.

This function checks if the absolute differences between the corresponding coordinates of two 3D points el1 and el2 are within a tolerance. Two points are considered equal, when the absolute difference is smaller than or equal to the tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set to 1e-3. The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 and el2 scaled by a given factor tol.

Parameters:

  • el1 (Point3D) –

    first point

  • el2 (Point3D) –

    second point

  • tol (float) –

    The tolerance factor used to determine the relative tolerance. When it's smaller than 1e-6, it's multiplied by 100.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For coordinates close to 1.0, the calculated tolerance is the same as the tolerance factor tol:

>>> Comparison.Equal(Point3D(1.00, 1.00, 1.00), 
...                  Point3D(1.01, 1.01, 1.01), 1e-2)
True
>>> Comparison.Equal(Point3D(1.00, 1.00, 1.00), 
...                  Point3D(1.02, 1.02, 1.02), 1e-2)
False

For large coordinates, the tolerance increases:

>>> Comparison.Equal(Point3D(1e6 + 0, 1e6 + 0, 1e6 + 0),
...                  Point3D(1e6 + 1, 1e6 + 1, 1e6 + 1), 1e-6)
True
>>> Comparison.Equal(Point3D(1e6 + 0, 1e6 + 0, 1e6 + 0),
...                  Point3D(1e6 + 2, 1e6 + 2, 1e6 + 2), 1e-6)
False

For small coordinates, setting the tolerance factor to a small value does not have an effect, because the minimum absolute tolerance of 1e-3 kicks in:

>>> Comparison.Equal(Point3D(1.0,   1.0,   1.0),
...                  Point3D(1.001, 1.001, 1.001), 1e-6)
True
Equal(el1: Vector2D, el2: Vector2D, tol: float) -> bool

Compare two 2D vectors to determine if they can be considered equal.

This function checks if the absolute differences between the corresponding coordinates of two vectors el1 and el2 are within a tolerance. Two vectors are considered equal, when the absolute difference is smaller than the tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set by the user in ALLPLAN settings. The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 scaled by the given factor tol.

Parameters:

  • el1 (Vector2D) –

    first vector

  • el2 (Vector2D) –

    second vector

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For coordinates close to 1.0, the calculated tolerance is the same as the tolerance factor tol:

>>> Comparison.Equal(Vector2D(1.0,   1.0), 
...                  Vector2D(1.009, 1.009), 1e-2)
True
>>> Comparison.Equal(Vector2D(1.00, 1.00), 
...                  Vector2D(1.01, 1.01), 1e-2)
False

For large coordinates, the tolerance increases:

>>> Comparison.Equal(Vector2D(1e6 + 0.0, 1e6 + 0.0),
...                  Vector2D(1e6 + 0.9, 1e6 + 0.9), 1e-6)
True
>>> Comparison.Equal(Vector2D(1e6 + 0, 1e6 + 0),
...                  Vector2D(1e6 + 1, 1e6 + 1), 1e-6)
False

For small coordinates, setting the tolerance factor to a small value does not have an effect, because the minimum absolute tolerance (set in ALLPLAN settings) becomes relevant:

>>> Comparison.Equal(Vector2D(1.0, 1.0),
...                  Vector2D(1.0 + 1e-3, 1.0 + 1e-3), 1e-6)
True
Equal(el1: Vector3D, el2: Vector3D, tol: float) -> bool

Compares two 3D vectors to determine if they can be considered equal.

This function checks if the absolute differences between the corresponding coordinates of two 3D vectors el1 and el2 are within a tolerance. Two vectors are considered equal, when the absolute difference is smaller than or equal to the tolerance. The tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance.

The minimum absolute tolerance is set to 1e-3. The relative tolerance is calculated based on the maximum absolute value of the coordinates of el1 and el2 scaled by a given factor tol.

Parameters:

  • el1 (Vector3D) –

    first vector

  • el2 (Vector3D) –

    second vector

  • tol (float) –

    The tolerance factor used to determine the relative tolerance. When it's smaller than 1e-6, it's multiplied by 100.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For coordinates close to 1.0, the calculated tolerance is the same as the tolerance factor tol:

>>> Comparison.Equal(Vector3D(1.00, 1.00, 1.00), 
...                  Vector3D(1.01, 1.01, 1.01), 1e-2)
True
>>> Comparison.Equal(Vector3D(1.0,  1.0,  1.0), 
...                  Vector3D(1.011, 1.011, 1.011), 1e-2)
False

For large coordinates, the tolerance increases:

>>> Comparison.Equal(Vector3D(1e6 + 0, 1e6 + 0, 1e6 + 0),
...                  Vector3D(1e6 + 1, 1e6 + 1, 1e6 + 1), 1e-6)
True
>>> Comparison.Equal(Vector3D(1e6 + 0.0, 1e6 + 0.0, 1e6 + 0.0),
...                  Vector3D(1e6 + 1.1, 1e6 + 1.1, 1e6 + 1.1), 1e-6)
False

For small coordinates, setting the tolerance factor to a small value does not have an effect, because the minimum absolute tolerance of 1e-3 becomes relevant:

>>> Comparison.Equal(Vector3D(1.0,   1.0,   1.0),
...                  Vector3D(1.001, 1.001, 1.001), 1e-6)
True
Equal(el1: Line2D, el2: Line2D, tol: float) -> bool

Compare two 2D lines with tolerance.

Two lines are considered equal, when their start and end points are considered equal (see Equal for 2D points) and the orientation of both lines is the same.

To check two lines for equality without considering the orientation, use Congruent or Overlapped.

Parameters:

  • el1 (Line2D) –

    first line

  • el2 (Line2D) –

    second line

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

>>> Comparison.Equal(Line2D(1.0,  1.0,  2.0,  2.0),
...                  Line2D(1.01, 1.01, 2.01, 2.01), 1e-1)
True
>>> Comparison.Equal(Line2D(1.0,  1.0,  2.0,  2.0),
...                  Line2D(1.01, 1.01, 2.01, 2.01), 1e-2)
False
Equal(el1: Line3D, el2: Line3D, tol: float) -> bool

Compare two 3D lines with tolerance

Two lines are considered equal, when their start and end points are considered equal (see Equal for 3D points) and the orientation of both lines is the same.

To check two 3D lines for equality without considering the orientation, use Overlapped.

Parameters:

  • el1 (Line3D) –

    first line

  • el2 (Line3D) –

    second line

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

>>> Comparison.Equal(Line3D(1.001, 1.001, 1.001, 2.001, 2.001, 2.001),
...                  Line3D(1.002, 1.002, 1.002, 2.002, 2.002, 2.002), 1e-3)
True
>>> Comparison.Equal(Line3D(1.001, 1.001, 1.001, 2.001, 2.001, 2.001),
...                  Line3D(1.002, 1.002, 1.002, 2.002, 2.002, 2.002), 1e-4)
False
Equal(el1: Spline2D, el2: Spline2D, tol: float) -> bool

Compare two 2D splines with tolerance

WARNING: This function is not fully implemented! It only compares the start and end vectors! See Equal for 2D vectors.

Parameters:

  • el1 (Spline2D) –

    first spline

  • el2 (Spline2D) –

    second spline

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Equal(el1: Clothoid2D, el2: Clothoid2D, tol: float) -> bool

Compare two 2D clothoids with tolerance.

Two clothoids are considered equal, when their:

  • start and end points
  • start and end curvatures
  • start vector
  • lengths
  • parallels
  • type
  • reference point

are considered equal. See Equal for 2D points, vectors and floating point numbers.

Parameters:

  • el1 (Clothoid2D) –

    first clothoid

  • el2 (Clothoid2D) –

    second clothoid

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Equal(el1: Arc2D, el2: Arc2D, tol: float) -> bool

Compare two 2D arcs with tolerance

Two arcs are considered equal, when their:

  • center points
  • major and minor radii
  • start and end angles
  • axis angles
  • directions (clockwise or counter-clockwise)

are considered equal. See Equal for 2D points and floating point numbers.

Parameters:

  • el1 (Arc2D) –

    first arc

  • el2 (Arc2D) –

    second arc

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Equal(el1: Arc3D, el2: Arc3D, tol: float) -> bool

Compare two 3D arcs with tolerance

Two arcs are considered equal, when their:

  • center points
  • major and minor radii
  • start and end angles
  • axis angles
  • directions (clockwise or counter-clockwise)

are considered equal. See Equal for 3D points and floating point numbers.

Parameters:

  • el1 (Arc3D) –

    first arc

  • el2 (Arc3D) –

    second arc

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Equal(el1: BSpline3D, el2: BSpline3D, tol: float) -> bool

Compare two 3D base splines with tolerance.

Two base splines are considered equal, when their:

  • degrees
  • control points
  • knots
  • weights

are considered equal. See Equal for 3D points and floating point numbers.

WARNING: Periodicity is not considered!

Parameters:

  • el1 (BSpline3D) –

    first b-spline

  • el2 (BSpline3D) –

    second b-spline

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal

Equal(el1: Spline3D, el2: Spline3D, tol: float) -> bool

Compare two 3D splines with tolerance

Two splines are considered equal, when their:

  • points
  • start and end vectors

are considered equal. See Equal for 3D points and vectors.

Parameters:

  • el1 (Spline3D) –

    first spline

  • el2 (Spline3D) –

    second spline

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal

Equal(el1: Polyline3D, el2: Polyline3D, tol: float) -> bool

Compare two 3D polylines with tolerance

Two polylines are considered equal, when all their points are considered equal. See Equal for 3D points.

Parameters:

  • el1 (Polyline3D) –

    first polyline

  • el2 (Polyline3D) –

    second polyline

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal

Equal(el1: BSpline2D, el2: BSpline2D, tol: float) -> bool

Compare two 2D base splines with tolerance

Two base splines are considered equal, when their:

  • degrees
  • control points
  • knots
  • weights

are considered equal. See Equal for 2D points and floating point numbers.

WARNING: Periodicity is not considered!

Parameters:

  • el1 (BSpline2D) –

    first b-spline

  • el2 (BSpline2D) –

    second b-spline

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal

Equal(path1: Path3D, path2: Path3D, tol: float) -> bool

Compare two 3D paths with tolerance

Parameters:

  • path1 (Path3D) –

    first path

  • path2 (Path3D) –

    second path

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal

Equal(igeo1: object, igeo2: object, tol: float) -> bool

Compare 2 geometries with given tolerance

Parameters:

  • igeo1 (object) –

    first geometry element

  • igeo2 (object) –

    second geometry element

  • tol (float) –

    value used to calculate allowed delta

Returns:

  • bool

    true when equal

EqualCoordsRel overloaded staticmethod

EqualCoordsRel(el1: Point2D, el2: Point2D) -> bool

Compare individual coordinates of two 2D points

The function uses EqualRel for floating point numbers to compare the coordinates.

Parameters:

Returns:

  • bool

    True if all coordinates are equal according to EqualRel, False otherwise.

EqualCoordsRel(el1: Point3D, el2: Point3D) -> bool

Compare individual coordinates of two 3D points

The function uses EqualRel for floating point numbers to compare the coordinates.

Parameters:

Returns:

  • bool

    True if all coordinates are equal according to EqualRel, False otherwise.

EqualDistance overloaded staticmethod

EqualDistance(el1: Point2D, el2: Point2D, tol: float) -> bool

Check, whether the distance between two 2D points is less then a given tolerance

The function uses CalcDistance to calculate the distance and compares it to the tol.

Parameters:

  • el1 (Point2D) –
    1. point
  • el2 (Point2D) –
    1. point
  • tol (float) –

    Absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • bool

    True if the distance is less than tol, False otherwise.

EqualDistance(el1: Point3D, el2: Point3D, tol: float) -> bool

Check, whether the distance between two 3D points is less then a given tolerance

The function uses CalcDistance to calculate the distance and compares it to the tol.

Parameters:

  • el1 (Point3D) –
    1. point
  • el2 (Point3D) –
    1. point
  • tol (float) –

    Absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • bool

    True if the distance is less than tol, False otherwise.

EqualRel overloaded staticmethod

EqualRel(el1: float, el2: float) -> bool

Compare two floating point numbers with default tolerance.

The default tolerance is a maximum of two values: relative tolerance and minimum absolute tolerance. The minimum absolute tolerance is set by the user in ALLPLAN settings (default 1e-2). The relative tolerance is calculated based on the maximum absolute value of the compared numbers scaled by a factor 1e-11.

Parameters:

  • el1 (float) –

    first number

  • el2 (float) –

    second number

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small numbers, the minimum absolute tolerance (set in ALLPLAN settings) is relevant:

>>> Comparison.EqualRel(Point2D(1, 1), Point2D(1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.EqualRel(Point2D(1, 1), Point2D(1 + 10e-3, 1 + 10e-3))
False

For large numbers, the relative tolerance is relevant:

>>> Comparison.EqualRel(1e11, 1e11 + 1)
True
>>> Comparison.EqualRel(1e11, 1e11 + 2)
False
EqualRel(el1: float, el2: float, tol: float) -> bool

Compare two floating point numbers with given relative tolerance.

The relative tolerance is calculated based on the maximum absolute value of the compared numbers scaled by a given tol factor.

Parameters:

  • el1 (float) –

    first number

  • el2 (float) –

    second number

  • tol (float) –

    The tolerance factor used to determine the relative tolerance.

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For a number close to 1.0, the tolerance is the same as the tolerance factor:

>>> Comparison.EqualRel(1, 1 + 2e-9, 1e-9)
True
>>> Comparison.EqualRel(1, 1 + 3e-9, 1e-9)
False

For large numbers, the tolerance increases:

>>> Comparison.EqualRel(1e9, 1e9 + 2, 1e-9)
True
>>> Comparison.EqualRel(1e9, 1e9 + 3, 1e-9)
False
EqualRel(el1: Point2D, el2: Point2D) -> bool

Compare two 2D points to determine if they can be considered equal. Use default tolerance.

This function works exactly the same, as Equal for 2D points.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance (set in ALLPLAN settings) is relevant:

>>> Comparison.EqualRel(Point2D(1, 1), Point2D(1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.EqualRel(Point2D(1, 1), Point2D(1 + 10e-3, 1 + 10e-3))
False

For large coordinates, the relative tolerance is relevant::

>>> Comparison.EqualRel(Point2D(1e12 + 0, 1e12 + 0), 
...                     Point2D(1e12 + 9, 1e12 + 9))
True
>>> Comparison.EqualRel(Point2D(1e12 + 0,  1e12 + 0), 
...                     Point2D(1e12 + 10, 1e12 + 10))
False
EqualRel(el1: Point3D, el2: Point3D) -> bool

Compares two 3D points to determine if they can be considered equal. Use default tolerance.

This function works exactly the same, as Equal for 2D points with the difference, that it compares 3D points.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance (set in ALLPLAN settings) is relevant.

>>> Comparison.EqualRel(Point3D(1, 1, 1), 
...                     Point3D(1 + 9e-3, 1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.EqualRel(Point3D(1, 1, 1), 
...                     Point3D(1 + 10e-3, 1 + 10e-3, 1 + 10e-3))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.EqualRel(Point3D(1e12 + 0, 1e12 + 0, 1e12 + 0), 
...                     Point3D(1e12 + 9, 1e12 + 9, 1e12 + 9))
True
>>> Comparison.EqualRel(Point3D(1e12 + 0,  1e12 + 0,  1e12 + 0), 
...                     Point3D(1e12 + 10, 1e12 + 10, 1e12 + 10))
False
EqualRel(el1: Vector2D, el2: Vector2D) -> bool

Compare two 2D vectors to determine if they can be considered equal. Use default tolerance.

This function works exactly the same, as Equal for 2D vectors.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance (set in ALLPLAN settings) is relevant.

>>> Comparison.EqualRel(Vector2D(1, 1), Vector2D(1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.EqualRel(Vector2D(1, 1), Vector2D(1 + 10e-3, 1 + 10e-3))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.EqualRel(Vector2D(1e12 + 0, 1e12 + 0), 
...                     Vector2D(1e12 + 9, 1e12 + 9))
True
>>> Comparison.EqualRel(Vector2D(1e12 + 0,  1e12 + 0), 
...                     Vector2D(1e12 + 10, 1e12 + 10))
False
EqualRel(el1: Vector3D, el2: Vector3D) -> bool

Compares two 3D vectors to determine if they can be considered equal. Use default tolerance.

This function works exactly the same, as Equal for 2D vectors with the difference, that it compares 3D vectors.

Parameters:

Returns:

  • bool

    true when equal, otherwise false.

Examples:

For small coordinates, the minimum absolute tolerance (set in ALLPLAN settings) is relevant:

>>> Comparison.EqualRel(Vector3D(1, 1, 1), 
...                     Vector3D(1 + 9e-3, 1 + 9e-3, 1 + 9e-3))
True
>>> Comparison.EqualRel(Vector3D(1, 1, 1), 
...                     Vector3D(1 + 10e-3, 1 + 10e-3, 1 + 10e-3))
False

For large coordinates, the relative tolerance is relevant:

>>> Comparison.EqualRel(Vector3D(1e12 + 0, 1e12 + 0, 1e12 + 0), 
...                     Vector3D(1e12 + 9, 1e12 + 9, 1e12 + 9))
True
>>> Comparison.EqualRel(Vector3D(1e12 + 0,  1e12 + 0,  1e12 + 0), 
...                     Vector3D(1e12 + 10, 1e12 + 10, 1e12 + 10))
False

GetSegmentNumber overloaded staticmethod

GetSegmentNumber(geoObject: object, segment: Line2D, tolerance: float) -> int

Determine, on which segment of a 2D geometry (line, polyline or polygon) a given line is located.

Internally, the function uses the DeterminePosition method.

Parameters:

  • geoObject (object) –

    The 2D geometry object (line, polyline or polygon).

  • segment (Line2D) –

    The line to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the line is located. The first segment has the number 0.

GetSegmentNumber(geoObject: object, point: Point3D, tolerance: float) -> int

Determine, on which segment of a 3D geometry (line, polyline or polygon) a given point is located.

Internally, the function uses the DeterminePosition method.

Parameters:

  • geoObject (object) –

    The 3D geometry object (line, polyline or polygon).

  • point (Point3D) –

    The point to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the point is located. The first segment has the number 0.

GetSegmentNumber(geoObject: object, point: Point2D, tolerance: float) -> int

Determine, on which segment of a 2D geometry (line, polyline, polygon or spline) a given point is located.

Internally, the function uses the DeterminePosition method.

Parameters:

  • geoObject (object) –

    The 2D geometry object (line, polyline, polygon or spline).

  • point (Point2D) –

    The point to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the point is located. The first segment has the number 0.

GetSegmentNumber(line: Line2D, point: Point2D, tolerance: float) -> int

Determine the segment position of a point to a Line2D

Parameters:

  • line (Line2D) –

    Line2D

  • point (Point2D) –

    Point2D

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    segment number 0 is first element

GetSegmentNumber(line: Line3D, point: Point3D, tolerance: float) -> int

Determine the segment position of a point to a Line3D

Parameters:

  • line (Line3D) –

    Line3D

  • point (Point3D) –

    Point3D

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    segment number 0 is first element

GetSegmentNumber(
    polyPoints: PolyPoints2D, point: Point2D, tolerance: float
) -> int

Determine, on which segment of a polygonal 2D geometry (polyline, polygon or spline) a given point is located.

Internally, the function uses the DeterminePosition method.

Parameters:

  • polyPoints (PolyPoints2D) –

    PolyPoints

  • point (Point2D) –

    The point to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the point is located. The first segment has the number 0.

GetSegmentNumber(polygon: Polygon2D, point: Point2D, tolerance: float) -> int

Determine, on which segment of a 2D polygon a given point is located.

Internally, the function uses the DeterminePosition method.

Parameters:

  • polygon (Polygon2D) –

    Polygon2D

  • point (Point2D) –

    Point2D

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the point is located. The first segment has the number 0.

Examples:

square_1 has a side length of 2.0 and lower left corner at (0, 0). Thus the point (2, 1) is on the second segment.

>>> Comparison.GetSegmentNumber(square_1, Point2D(2, 1), 1e-6)
1

A point not located on any segment returns the maximum unsigned integer value.

>>> Comparison.GetSegmentNumber(square_1, Point2D(0.5, 0.5), 1e-6)
18446744073709551615
GetSegmentNumber(
    polyPoints: PolyPoints3D, point: Point3D, tolerance: float
) -> int

Determine, on which segment of a polygonal 3D geometry a given point is located.

Internally, the function uses the DeterminePosition method.

Parameters:

  • polyPoints (PolyPoints3D) –

    PolyPoints

  • point (Point3D) –

    The point to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the point is located. The first segment has the number 0.

GetSegmentNumber(spline: Spline2D, point: Point2D, tolerance: float) -> int

Determine, on which segment of a spline a given point is located.

Internally, the function uses the TransformCoord.PointLocal to determine the local coordinates of the given point and then performs the check.

Parameters:

  • spline (Spline2D) –

    spline geo

  • point (Point2D) –

    point on spline

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment on which the point is located. The first segment has the number 0.

Examples:

spline_1 has 4 control points: (0, 0), (2, 2), (3, 1) and (4, 3). Thus the point (1.0427012142, 1.70189742) is on the first segment.

>>> Comparison.GetSegmentNumber(spline_1, Point2D(1.0427012142, 1.70189742), 1e-6)
0
>>> Comparison.GetSegmentNumber(spline_1, Point2D(1.0, 1.0), 1e-6)
18446744073709551615
GetSegmentNumber(line: Line2D, segment: Line2D, tolerance: float) -> int

Check, whether the line coincide with the segment.

Parameters:

  • line (Line2D) –

    Line2D

  • segment (Line2D) –

    Line2D

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    0 if lines are congruent. Otherwise, maximum unsigned integer value

GetSegmentNumber(line: Line3D, segment: Line3D, tolerance: float) -> int

Check, whether the line coincide with the segment.

Parameters:

  • line (Line3D) –

    Line3D

  • segment (Line3D) –

    Line3D

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    0 if lines are congruent. Otherwise, maximum unsigned integer value

GetSegmentNumber(
    polyPoints: PolyPoints2D, segment: Line2D, tolerance: float
) -> int

Determine, with which segment of a polygonal 2D geometry (polyline, polygon or spline) a given line coincides.

Parameters:

  • polyPoints (PolyPoints2D) –

    PolyPoints

  • segment (Line2D) –

    line to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment with which the line coincides. The first segment has the number 0.

Examples:

square_1 has a side length of 2.0 and lower left corner at (0, 0). Thus the line from (2, 0) to (2, 2) coincides with the second segment.

>>> Comparison.GetSegmentNumber(square_1, Line2D(2, 0, 2, 2), 1e-6)
1

A line not coinciding with any segment returns the maximum unsigned integer value.

>>> Comparison.GetSegmentNumber(square_1, Line2D(0.5, 0.5, 1.5, 1.5), 1e-6)
18446744073709551615
GetSegmentNumber(
    polyPoints: PolyPoints3D, segment: Line3D, tolerance: float
) -> int

Determine, with which segment of a polygonal 3D geometry a given line coincides.

Parameters:

  • polyPoints (PolyPoints3D) –

    PolyPoints

  • segment (Line3D) –

    line to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment with which the line coincides. The first segment has the number 0.

Examples:

square_3d has a side length of 1.0, lower left corner at (0, 0) and aligns with XY plane. Thus the line from (1, 0, 0) to (1, 1, 0) coincides with the second segment.

>>> Comparison.GetSegmentNumber(square_3d, Line3D(1, 0, 0, 1, 1, 0), 1e-6)
1

A line not coinciding with any segment returns the maximum unsigned integer value.

>>> Comparison.GetSegmentNumber(square_3d, Line3D(0.5, 0.5, 0, 1.5, 1.5, 0), 1e-6)
18446744073709551615
GetSegmentNumber(geoObject: object, segment: Line3D, tolerance: float) -> int

Determine, with which segment of a given geometry the 3D line coincides.

Parameters:

  • geoObject (object) –

    IGeometry

  • segment (Line3D) –

    line to be checked.

  • tolerance (float) –

    The absolute tolerance. For exact comparison, provide small number (e.g. 1e-6) but not 0 (floating point arithmetic).

Returns:

  • int

    Number of the segment with which the line coincides. The first segment has the number 0.

HitsElement staticmethod

HitsElement(result: eComparisionResult) -> bool

Check if comparison result hits element in some way

Parameters:

Returns:

  • bool

    true, if the result indicates that the element is hit, otherwise false e.g. left, right, etc.

IsInside overloaded staticmethod

IsInside(polygon: Polygon2D, line: Line2D) -> bool

Determine if the line is inside the polygon

Parameters:

Returns:

  • bool

    true, if the line is inside the polygon

Examples:

square_1 has a side length of 2.0 and lower left corner at (0, 0). Thus the diagonal line from (0.5, 0.5) to (1.5, 1.5) is considered to be inside.

>>> Comparison.IsInside(square_1, Line2D(0.5, 0.5, 1.5, 1.5))
True

A line with end points on the square vertices is considered to be outside.

>>> Comparison.IsInside(square_1, Line2D(0, 0, 2, 2))
False

A line with end points on the square edges is considered to be outside.

>>> Comparison.IsInside(square_1, Line2D(0, 1, 2, 1))
False
IsInside(line: Line2D, lineToCheck: Line2D) -> bool

Check, whether the lineToCheck is inside the line.

The method uses DeterminePosition method with the default relative tolerance.

Parameters:

  • line (Line2D) –

    reference line

  • lineToCheck (Line2D) –

    line to be checked

Returns:

  • bool

    True if the lineToCheck is inside the line, False otherwise.

Examples:

>>> Comparison.IsInside(Line2D(0,0,2,2), Line2D(0.5, 0.5, 1.5, 1.5))
True
>>> Comparison.IsInside(Line2D(0,0,2,2), Line2D(0.5, 0.5, 2.5, 2.5))
False

IsParallel overloaded staticmethod

IsParallel(el1: Line2D, el2: Line2D) -> tuple[eComparisionResult, float]

test two 2D lines for parallel

Parameters:

Returns:

  • eComparisionResult

    Result of the comparison; eParallel, eAntiParallel or eNotParallel

  • float

    Distance between the lines (if parallel)

Examples:

>>> Comparison.IsParallel(Line2D(0, 0, 1, 1), Line2D(0, 1, 1, 2))
(NemAll_Python_Geometry.eComparisionResult.eParallel, 0.7071...)
>>> Comparison.IsParallel(Line2D(0, 0, 1, 1), Line2D(1, 2, 0, 1))
(NemAll_Python_Geometry.eComparisionResult.eAntiParallel, 0.7071...)
>>> Comparison.IsParallel(Line2D(0, 0, 1, 1), Line2D(1, 0, 0, 1))
(NemAll_Python_Geometry.eComparisionResult.eNotParallel, ...)
IsParallel(lines: Line2DList) -> eComparisionResult

Check of parallelism for vector of 2D lines

Return eAntiParallel if at least one line is antiparallel and all rest are parallel Return eNotParallel if at least one line is not parallel In all rest cases return eParallel

Parameters:

  • lines (Line2DList) –

    List of 2D lines to compare

Returns:

Examples:

parallel_lines is a list of 4 parallel lines with the same orientation

>>> parallel_lines
Line2D(0, 0, 1, 0)
Line2D(0, 1, 1, 1)
Line2D(0, 2, 1, 2)
Line2D(0, 3, 1, 3)
>>> Comparison.IsParallel(parallel_lines)
NemAll_Python_Geometry.eComparisionResult.eParallel

When at lease one line is reversed, the result is eAntiParallel

>>> parallel_lines[2].Reverse()
>>> Comparison.IsParallel(parallel_lines)
NemAll_Python_Geometry.eComparisionResult.eAntiParallel

When at least one line is not parallel, the result is eNotParallel

>>> parallel_lines[3].Set(0, 3, 1, 4)
>>> Comparison.IsParallel(parallel_lines)
NemAll_Python_Geometry.eComparisionResult.eNotParallel
IsParallel(el1: Line3D, el2: Line3D) -> tuple[eComparisionResult, float]

test two 3D lines for parallel

Parameters:

Returns:

  • eComparisionResult

    Result of the comparison; eParallel, eAntiParallel or eNotParallel

  • float

    Distance between the lines (if parallel)

Examples:

>>> Comparison.IsParallel(Line3D(0, 0, 0, 1, 1, 1), Line3D(0, 1, 0, 1, 2, 1))
(NemAll_Python_Geometry.eComparisionResult.eParallel, 0.8164...)
>>> Comparison.IsParallel(Line3D(0, 0, 0, 1, 1, 1), Line3D(1, 2, 1, 0, 1, 0))
(NemAll_Python_Geometry.eComparisionResult.eAntiParallel, 0.8164...)
>>> Comparison.IsParallel(Line3D(0, 0, 0, 1, 1, 1), Line3D(1, 0, 0, 0, 1, 1))
(NemAll_Python_Geometry.eComparisionResult.eNotParallel, ...)
IsParallel(el1: object, el2: object) -> tuple[eComparisionResult, float]

test two Geometry object for parallel

Parameters:

  • el1 (object) –

    first geometry element

  • el2 (object) –

    second geometry element

Returns:

  • eComparisionResult

    Result of the comparison; eParallel, eAntiParallel or eNotParallel

  • float

    Distance between the lines (if parallel)

Overlapped overloaded staticmethod

Overlapped(el1: Polyline2D, el2: Polyline2D) -> bool

Check, whether the two polylines overlap.

For two polyline to overlap, they must have the same number of segments and each segment must be congruent to the corresponding segment of the other polyline. Segments are compared by comparing their end points with the Equal method using default tolerance. Orientation of the polylines is irrelevant.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Examples:

Two identical polylines overlap

>>> polyline1 = Polyline2D([Point2D(0, 0), Point2D(1, 1), Point2D(2, 2)])
>>> polyline2 = Polyline2D(polyline1)
>>> Comparison.Overlapped(polyline1, polyline2)
True

Reversing one polyline does not affect the result

>>> polyline2.Reverse()
>>> Comparison.Overlapped(polyline1, polyline2)
True

Changing any point of the polyline makes them not overlap

>>> polyline2[2] = Point2D(3,3)
>>> Comparison.Overlapped(polyline1, polyline2)
False
Overlapped(
    el1: Polyline3D, el2: Polyline3D, partiallyToo: bool = False
) -> bool

Check, whether the two polylines overlap.

For two polyline to overlap, they must have the same number of segments and each segment must be congruent to the corresponding segment of the other polyline. Segments are compared by comparing their end points with the Equal method using default tolerance. Orientation of the polylines is irrelevant.

Parameters:

  • el1 (Polyline3D) –

    Polyline3D

  • el2 (Polyline3D) –

    Polyline3D

  • partiallyToo (bool, default: False ) –

    First and last segment of polyline have not be identical but is enough that lies on the second polyline segments

Returns:

  • bool

    true when overlapped, otherwise false

Examples:

Two identical polylines are considered overlapped

>>> polyline1 = Polyline3D([Point3D(0, 0, 0), Point3D(1, 1, 2), Point3D(2, 2, 1), Point3D(3, 3, 3)])
>>> polyline2 = Polyline3D(polyline1)
>>> Comparison.Overlapped(polyline1, polyline2)
True

When one polyline has reversed orientation, both are still considered overlapped

>>> polyline2.Reverse()
>>> Comparison.Overlapped(polyline1, polyline2)
True

When option partiallyToo is set to True, both polyline are considered overlapped when the first or last segment at least partially overlap

>>> polyline1[0] = Point3D(0.5, 0.5, 1)
>>> Comparison.Overlapped(polyline1, polyline2, True)
True
Overlapped(pp1: PolyPoints2D, pp2: PolyPoints2D) -> bool

Check, whether two polygonal 2D curves overlap.

For two polygonal curves to overlap, they must have the same number of segments and each vertex must be congruent to the corresponding vertex of the other geometry. Orientation of the curves is irrelevant. Vertices are compared with the Equal method using default tolerance.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Overlapped(pp1: PolyPoints3D, pp2: PolyPoints3D) -> bool

Check, whether two polygonal 3D curves overlap.

For two polygonal curves to overlap, they must have the same number of segments and each vertex must be congruent to the corresponding vertex of the other geometry. Orientation of the curves is irrelevant. Vertices are compared with the Equal method using default tolerance.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Overlapped(line1: Line2D, line2: Line2D) -> bool

Check, whether two 2D lines overlap.

The function delivers exactly the same results, as Comparision.Congruent for 2D lines.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Examples:

Two identical lines overlap

>>> Comparison.Overlapped(Line2D(0, 0, 1, 1), Line2D(0, 0, 1, 1))
True

Reversing one line does not affect the result

>>> Comparison.Overlapped(Line2D(0, 0, 1, 1), Line2D(1, 1, 0, 0))
True
Overlapped(line1: Line3D, line2: Line3D, partiallyToo: bool = False) -> bool

Check, whether two 3D lines overlap.

For two lines to overlap, their end points must be considered equal according to Equal method. Orientation of the lines is irrelevant.

Parameters:

  • line1 (Line3D) –

    Line3D

  • line2 (Line3D) –

    Line3D

  • partiallyToo (bool, default: False ) –

    Lines have not be identical but is enough that one lies on the second

Returns:

  • bool

    true when overlapped, otherwise false

Examples:

Two identical lines overlap

>>> Comparison.Overlapped(Line3D(0, 0, 0, 1, 1, 1), 
...                       Line3D(0, 0, 0, 1, 1, 1))
True

Reversing one line does not affect the result

>>> Comparison.Overlapped(Line3D(0, 0, 0, 1, 1, 1),
...                       Line3D(1, 1, 1, 0, 0, 0))
True

With the option partiallyToo set to True, the lines are considered overlapped when they at least partially overlap

>>> Comparison.Overlapped(Line3D(0.0, 0.0, 0.0, 1, 1, 1),
...                       Line3D(0.5, 0.5, 0.5, 1, 1, 1), True)
True
Overlapped(arc1: Arc2D, arc2: Arc2D) -> bool

Check, whether two 2D arcs overlap

For two arcs to overlap, they must be considered equal according to Equal method, except for the orientation, which is irrelevant.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Examples:

Two identical arcs overlap:

>>> arc_2 = Arc2D(arc_1)
>>> Comparison.Overlapped(arc_1, arc_2)
True

Reversing one arc does not affect the result:

>>> arc_2.Reverse()
>>> Comparison.Overlapped(arc_1, arc_2)
True
Overlapped(arc1: Arc3D, arc2: Arc3D) -> bool

Check, whether two 3D arcs overlap

For two arcs to overlap, they must be considered equal according to Equal method,

IMPORTANT: The orientation is considered!

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Examples:

Two identical arcs overlap:

>>> arc3d_2 = Arc3D(arc_3)
>>> Comparison.Overlapped(arc_3, arc3d_2)
True

Reversing one arc does affect the result!

>>> arc3d_2.Reverse()
>>> Comparison.Overlapped(arc_3, arc3d_2)
False
Overlapped(phed1: Polyhedron3D, phed2: Polyhedron3D) -> bool

Check, whether two polyhedrons overlap.

For two polyhedrons to overlap, they must have the same min-max boxes, equal number of edges and vertices, and each vertex must be congruent to the corresponding vertex of the other polyhedron. Orientation of the edges is irrelevant. The vertices are compared with the Equal method using default tolerance.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Overlapped(el1: Spline2D, el2: Spline2D) -> bool

Check, whether two 2D splines overlap.

For two splines to overlap, they must have the same number of segments, the same end vectors and each control point must be congruent to the corresponding control point of the other spline. Orientation of the splines is irrelevant. Points and vectors are compared with the Equal method using default tolerance.

Parameters:

Returns:

  • bool

    true when overlapped, otherwise false

Overlapped(geo1: object, geo2: object) -> bool

Check, whether two geometries overlap.

See the specific methods for the details of the comparison.

Parameters:

  • geo1 (object) –

    IGeometry

  • geo2 (object) –

    IGeometry

Returns:

  • bool

    true when overlapped, otherwise false

signum staticmethod

signum(a: float, tol: float) -> float

sgn function

Parameters:

  • a (float) –

    Number of which to compute sign

  • tol (float) –

    tolerance

Returns:

  • float

    0, 1, -1

Placeholder