AutoOpenLine2D Module
When Euclid is opened this module will be auto-opened. It only contains extension members for type Line2D.
Type extensions
Type extension |
Description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
this.Extend
Parameters:
float
distAtEnd : float
Returns: Line2D
Modifiers: inline |
|
|
|
|
|
Full Usage:
this.ExtendRel
Parameters:
float
relAtEnd : float
Returns: Line2D
Modifiers: inline |
|
|
|
|
|
Full Usage:
this.IsCoincidentTo
Parameters:
Line2D
distanceTolerance : float
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if two 2D lines are coincident within the distance tolerance. 1e-6 by default. This means that lines are parallel within the angle tolerance and the distance of second start to the first line is less than the distance tolerance. Also returns false on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12). The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module.
Extended Type:
|
Full Usage:
this.IsParallelAndOrientedTo
Parameters:
Line2D
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if two 2D lines are parallel. Takes the line orientation into account too. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsParallelAndOrientedTo
Parameters:
Vc
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if a 2D lines is parallel to a 2D vector. Takes the line orientation into account too. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module. Fails on lines or vectors shorter than 1e-12.
Extended Type:
|
Full Usage:
this.IsParallelAndOrientedTo
Parameters:
UnitVc
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if a 2D lines is parallel to a 2D unit-vector. Takes the line orientation into account too. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsParallelTo
Parameters:
Line2D
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if two 2D lines are parallel. Ignores the line orientation. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsParallelTo
Parameters:
Vc
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if a 2D lines is parallel to a 2D vector. Ignores the line orientation. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module. Fails on lines or vectors shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsParallelTo
Parameters:
UnitVc
minCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if a 2D lines is parallel to a 2D unit-vector. Ignores the line orientation. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minium cosine value. See Euclid.Cosine module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsPerpendicularTo
Parameters:
Line2D
maxCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if two 2D lines are perpendicular to each other. The default angle tolerance is 89.75 to 90.25 degrees. This tolerance can be customized by an optional minium cosine value. The default cosine is 0.0043633 ( = 89.75 deg) See Euclid.Cosine module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsPerpendicularTo
Parameters:
Vc
maxCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if a 2D lines is perpendicular to a 2D vector. The default angle tolerance is 89.75 to 90.25 degrees. This tolerance can be customized by an optional minium cosine value. The default cosine is 0.0043633 ( = 89.75 deg) See Euclid.Cosine module. Fails on lines or vectors shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
Full Usage:
this.IsPerpendicularTo
Parameters:
UnitVc
maxCosine : float<MeasureProduct<cosine, MeasureOne>>
Returns: bool
Modifiers: inline |
Checks if a 2D lines is perpendicular to a 2D unit-vector. The default angle tolerance is 89.75 to 90.25 degrees. This tolerance can be customized by an optional minium cosine value. The default cosine is 0.0043633 ( = 89.75 deg) See Euclid.Cosine module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).
Extended Type:
|
|
|
|
|
Full Usage:
this.IsTiny
Parameters:
float
Returns: bool
Modifiers: inline |
Check if line is shorter than tolerance. Or has NaN components.
Extended Type:
|
Full Usage:
this.IsTinySq
Parameters:
float
Returns: bool
Modifiers: inline |
Check if the lines square length is shorter than squared tolerance. Or has NaN components.
Extended Type:
|
Full Usage:
this.IsXAligned
Parameters:
unit
Returns: bool
Modifiers: inline |
Checks if 2D line is parallel to the world X axis. Ignoring orientation. The absolute deviation tolerance along Y axis is 1e-9. Fails on lines shorter than 1e-6.
Extended Type:
|
Full Usage:
this.IsXAligned
Returns: bool
Modifiers: inline |
Checks if 2D line is parallel to the world X axis. Ignoring orientation. The absolute deviation tolerance along Y axis is 1e-9. Fails on lines shorter than 1e-6.
Extended Type:
|
Full Usage:
this.IsYAligned
Parameters:
unit
Returns: bool
Modifiers: inline |
Checks if 2D line is parallel to the world Y axis. Ignoring orientation. The absolute deviation tolerance along X axis is 1e-9. Fails on lines shorter than 1e-6.
Extended Type:
|
Full Usage:
this.IsYAligned
Returns: bool
Modifiers: inline |
Checks if 2D line is parallel to the world Y axis. Ignoring orientation. The absolute deviation tolerance along X axis is 1e-9. Fails on lines shorter than 1e-6.
Extended Type:
|
Full Usage:
this.IsZeroLength
Parameters:
unit
Returns: bool
Modifiers: inline |
|
Full Usage:
this.IsZeroLength
Returns: bool
Modifiers: inline |
|
Full Usage:
this.LengthFromParam
Parameters:
float
Returns: float
Modifiers: inline |
Returns the length of the line segment from the given parameter till the line End. This length is negative if the parameter is bigger than 1.0.
Extended Type:
|
Full Usage:
this.LengthTillParam
Parameters:
float
Returns: float
Modifiers: inline |
Returns the length of the line segment from the start point to the given parameter. This length is negative if the parameter is negative.
Extended Type:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
this.Shrink
Parameters:
float
distAtEnd : float
Returns: Line2D
Modifiers: inline |
|
|
|
|
|
|
|
|
|
|
Checks if two 2D lines are parallel. Ignoring orientation. Calculates the Cross Product of the two line vectors. (= the area of the parallelogram) And checks if it is smaller than 1e-9 (NOTE: for very long lines a higher tolerance might be needed)
Extended Type:
|
|
Checks if two 2D lines are parallel and orientated the same way. Calculates the Cross Product of the two line vectors. (= the area of the parallelogram) And checks if it is smaller than 1e-9 Then calculates the dot product and checks if it is positive. (NOTE: for very long lines a higher tolerance might be needed)
Extended Type:
|
|
|
Full Usage:
Line2D.areTouchingAny tol a b
Parameters:
float
-
The tolerance for the distance between the end points.
a : Line2D
-
The first line.
b : Line2D
-
The second line.
Returns: int
An integer value indicating the touching case:
0 if not touching,
1 if touching at End of A and Start of B,
2 if touching at Start of A and End of B,
3 if touching at Start of A and Start of B,
4 if touching at End of A and End of B
|
Checks if the two finite 2D lines are touching each other at any of end points within the given tolerance. This will also return found result if the lines are touching on both points.
Extended Type:
|
Full Usage:
Line2D.areTouchingEither tol a b
Parameters:
float
-
The tolerance for the distance between the end points.
a : Line2D
-
The first line.
b : Line2D
-
The second line.
Returns: int
An integer value indicating the touching case:
0 if not touching,
1 if touching at End of A and Start of B,
2 if touching at Start of A and End of B,
3 if touching at Start of A and Start of B,
4 if touching at End of A and End of B,
5 if touching at both Start and End. Lines are identical and in same orientation.
6 if touching at both at the other Start or End. Lines are identical but in opposite orientation.
|
Checks if the two finite 2D lines are touching each other at exactly one of their end points within the given tolerance. This will return a separate case (5 or 6) if the lines are touching on both points.
Extended Type:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns the distance between two finite 2D lines. For parallel lines the distance is calculate form the actual finit elements. (like in the other cases.) So it is maybe bigger than the parallel offset. For Coincident and intersecting lines it always returns 0.0 even if there is actually a distance less than 1e-6.
Extended Type:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Divides a 2D line into as few as segments as possible respecting the maximum segment length. Returned Array includes start and endpoint of line. The input maxSegmentLength is multiplied by factor 0.999999 of to avoid numerical errors. That means in an edge case there are fewer segments returned, not more.
Extended Type:
|
|
Divides a 2D line into as many as segments as possible respecting the minimum segment length. Returned Array includes start and endpoint of line. The input minSegmentLength is multiplied by factor 1.000001 of to avoid numerical errors. That means in an edge case there are more segments returned, not fewer.
Extended Type:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
Line2D.intersection (lnA, lnB, relAngleDiscriminant, coincidentTolerance, tooShortTolerance)
Parameters:
Line2D
-
The first line.
lnB : Line2D
-
The second line.
relAngleDiscriminant : float<MeasureProduct<relAngDiscr, MeasureOne>>
-
This is an optional tolerance for the internally calculated relative Angle Discriminant.
The default value is '0.00000952' this corresponds to approx 0.25 degree. Below this angle the 'Parallel' or 'Coincident' union case is returned.
Use the module Euclid.UtilEuclid.RelAngleDiscriminant to set another tolerance here.
coincidentTolerance : float
-
Is an optional distance tolerance. 1e-6 by default.
If parallel lines are closer than this, then the 'Coincident' union case is returned.
tooShortTolerance : float
-
Is an optional length tolerance. 1e-6 by default.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
Returns: IntersectionKind * Pt * Pt
Modifiers: inline |
Returns the intersection kind and the points at which two (finite) 2D Lines are intersecting or closest to each other. The returned points are on the respective lines. For parallel and coincident lines it still returns the two end points that are closest to each other or a point in the middle of their overlap. First point is on lnA, second point is on lnB. The possible result cases are: | Intersecting : The finite lines are intersecting each other in one point. | IntersectingEndsBoth: The finite lines are intersecting each other at one of their end or start points point. | IntersectingEndsFirst: The finite lines are intersecting. The first line is touching the second one with its end or start point. | IntersectingEndsSecond: The finite lines are intersecting. The second line is touching the first one with its end or start point. | Skew: (but only applicable for 3D lines) | Apart: The finite lines are not intersecting. At least one of the points of closets points would be outside of the range 0.0 and 1.0. The returned points still indicate where the finite lines are closest to each other. ------- Parallel and other special cases for finite lines: --------------- | Parallel : The finite lines are parallel. Within 0.25 degrees. The returned points are in the middle of their overlap, or the two end points that are closest to each other. | Overlapping The lines are coincident, overlapping and parallel within 0.25 degrees. The returned points are at start and end of overlap. | CoincidentApart: The lines are coincident, parallel within 0.25 degrees. But ends are apart. The returned points still indicate where the lines are closest to each other. | Continuation : The lines are coincident, parallel within 0.25 degrees. The ends are meeting in exactly one point. And Oriented the same way. The returned points indicate which ends these are. | ContinuationFlipped: The lines are coincident, parallel within 0.25 degrees. The ends are meeting in exactly one point. But orientation is flipped. The returned points indicate which ends these are. | Identical: The lines are identical, in orientation too with in 1e-6 tolerance. The returned points still indicate where the lines start and end. | IdenticalFlipped: The lines are identical. But orientation is flipped. The returned points still indicate where the lines start and end. ------------------------------Error Cases: ----------------------------- | TooShortA Input line A is shorter than the given minimum Length tolerance. The returned points are the middle of line A and the closets point to it on line B. | TooShortB Input line B is shorter than the given minimum Length tolerance. The returned points are the closets point to lineA from the middle of line B and the middle of line B. | TooShortBoth Both input lines are shorter than the given minimum Length tolerance. The returned points are in the middle of both lines.
Extended Type:
|
Full Usage:
Line2D.intersectionInfinite (lnA, lnB, relAngleDiscriminant, coincidentTolerance, tooShortTolerance)
Parameters:
Line2D
-
The first line.
lnB : Line2D
-
The second line.
relAngleDiscriminant : float<MeasureProduct<relAngDiscr, MeasureOne>>
-
This is an optional tolerance for the internally calculated relative Angle Discriminant.
The default value is '0.00000952' this corresponds to approx 0.25 degree. Below this angle the 'Parallel' or 'Coincident' union case is returned.
Use the module Euclid.UtilEuclid.RelAngleDiscriminant to set another tolerance here.
coincidentTolerance : float
-
Is an optional distance tolerance. 1e-6 by default.
If parallel lines are closer than this, then the 'Coincident' union case is returned.
tooShortTolerance : float
Returns: IntersectionPoints2D
An IntersectionPoints2D Discriminated Union with the following cases:
Is an optional length tolerance. 1e-6 by default.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
| Point of xPoint : Pnt
The points of 2D intersection.
| Parallel:
The lines are parallel, within the given tolerance.
| Coincident:
The lines are coincident or maybe even identical.
As infinite lines they have infinitely many points in common.
| TooShort:
One or both input lines is shorter than the given minimum Length tolerance.
Modifiers: inline |
Gets the points at which two infinite 2D lines intersect. Or are closest to each other.
Extended Type:
|
Full Usage:
Line2D.intersectionParam (lnA, lnB, relAngleDiscriminant, coincidentTolerance, tooShortTolerance)
Parameters:
Line2D
-
The first line.
lnB : Line2D
-
The second line.
relAngleDiscriminant : float<MeasureProduct<relAngDiscr, MeasureOne>>
-
This is an optional tolerance for the internally calculated relative Angle Discriminant.
The default value is '0.00000952' this corresponds to approx 0.25 degree. Below this angle the 'Parallel' or 'Coincident' union case is returned.
Use the module Euclid.UtilEuclid.RelAngleDiscriminant to set another tolerance here.
coincidentTolerance : float
-
Is an optional distance tolerance. 1e-6 by default.
If parallel lines are closer than this, then the 'Coincident' union case is returned.
tooShortTolerance : float
-
Is an optional length tolerance. 1e-6 by default.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
Returns: IntersectionKind * float * float
Modifiers: inline |
Returns the intersection kind and the parameters at which two (finite) 2D Lines intersect or are closest to each other. The returned parameters are both between 0.0 and 1.0. For parallel and coincident lines it still returns the two end points that are closest to each other or a point in the middle of their overlap. First parameter is on lnA, second parameter is on lnB. The possible result cases are: | Intersecting : The finite lines are intersecting each other in one point inside both lines. | IntersectingEndsBoth: The finite lines are intersecting each other at one of their end or start points point. | IntersectingEndsFirst: The finite lines are intersecting. The first line is touching the second one with its end or start point. | IntersectingEndsSecond: The finite lines are intersecting. The second line is touching the first one with its end or start point. | Skew: (only applicable for 3D lines) | Apart: The finite lines are not intersecting . At least one of the parameters of closets points would be outside of the range 0.0 and 1.0. The returned parameters still indicate where the finite lines are closest to each other. ------- Parallel and other special cases for finite lines: --------------- | Parallel : The finite lines are parallel. Within 0.25 degrees. The returned parameters are in the middle of their overlap, or the two end points that are closest to each other. | Overlapping The lines are coincident, overlapping and parallel within 0.25 degrees. The returned parameters are at start and end of overlap. | CoincidentApart: The lines are coincident, parallel within 0.25 degrees. But ends are apart. The returned parameters still indicate where the lines are closest to each other. | Continuation : The lines are coincident, parallel within 0.25 degrees. The ends are meeting in exactly one point. And Oriented the same way. The returned parameters indicate which ends these are. | ContinuationFlipped: The lines are coincident, parallel within 0.25 degrees. The ends are meeting in exactly one point. But orientation is flipped. The returned parameters indicate which ends these are. | Identical: The lines are identical, in orientation too with in 1e-6 tolerance. The returned parameters still indicate where the lines start and end. | IdenticalFlipped: The lines are identical. But orientation is flipped. The returned parameters still indicate where the lines start and end. ------------------------------Error Cases: ----------------------------- | TooShortA Input line A is shorter than the given minimum Length tolerance. The returned parameters are 0.5 for line A and the closets point to lineB from the middle of line A. | TooShortB Input line B is shorter than the given minimum Length tolerance. The returned parameters are the closets point to lineA from the middle of line B and 0.5 for line B. | TooShortBoth Both input lines are shorter than the given minimum Length tolerance. The returned parameters are 0.5 and 0.5 for both lines.
Extended Type:
|
Full Usage:
Line2D.intersectionParamInfinite (lnA, lnB, relAngleDiscriminant, coincidentTolerance, tooShortTolerance)
Parameters:
Line2D
-
The first line.
lnB : Line2D
-
The second line.
relAngleDiscriminant : float<MeasureProduct<relAngDiscr, MeasureOne>>
-
This is an optional tolerance for the internally calculated relative Angle Discriminant.
The default value is '0.00000952' this corresponds to approx 0.25 degree. Below this angle the 'Parallel' or 'Coincident' union case is returned.
Use the module Euclid.UtilEuclid.RelAngleDiscriminant to set another tolerance here.
coincidentTolerance : float
-
Is an optional distance tolerance. 1e-6 by default.
If parallel lines are closer than this, then the 'Coincident' union case is returned.
tooShortTolerance : float
-
Is an optional length tolerance. 1e-6 by default.
If one or both lines are shorter than this, then the 'TooShort' union case is returned.
Returns: IntersectionParam
An IntersectionParam Discriminated Union with the following cases:
| TwoParam of twoParams : struct(float*float):
The infinite lines are intersecting.
They have each one point where they are intersecting each other.
The tuple's order corresponds to the input order.
| Parallel:
The lines are parallel within 0.25 degrees.
They have no points in common.
| Coincident:
The lines are coincident (or maybe even identical) .
As infinite lines they have infinitely many points in common.
They might still not have the same start and end points in their finit definition.
| TooShort:
One or both input lines is shorter than the given minimum Length tolerance.
Modifiers: inline |
Intersects two infinite 2D lines.
Extended Type:
|
|
|
Full Usage:
Line2D.intersectionPointInfinite (lnA, lnB, relAngleDiscriminant, coincidentTolerance, tooShortTolerance)
Parameters:
Line2D
-
The first line.
lnB : Line2D
-
The second line.
relAngleDiscriminant : float<MeasureProduct<relAngDiscr, MeasureOne>>
-
This is an optional tolerance for the internally calculated relative Angle Discriminant.
The default value is '0.00000952' this corresponds to approx 0.25 degree. Below this angle an EuclidException is raised.
Use the module Euclid.UtilEuclid.RelAngleDiscriminant to set another tolerance here.
coincidentTolerance : float
-
Is an optional distance tolerance. 1e-6 by default.
If parallel lines are closer than this, then an EuclidException is raised.
tooShortTolerance : float
-
Is an optional length tolerance. 1e-6 by default.
If one or both lines are shorter than this, then an EuclidException is raised.
Returns: Pt
A single 2D point
|
Gets the single points where these two infinite 2D lines actually intersect each other. The returned point is on line A.
Extended Type:
|
|
|
Full Usage:
Line2D.isTinySq tol l
Parameters:
float
l : Line2D
Returns: bool
Modifiers: inline |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
Line2D.rotate r ln
Parameters:
Rotation2D
ln : Line2D
Returns: Line2D
Modifiers: inline |
|
Full Usage:
Line2D.rotateWithCenter cen r ln
Parameters:
Pt
r : Rotation2D
ln : Line2D
Returns: Line2D
Modifiers: inline |
Rotation a Line2D around a given Center.
Extended Type:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Divides a 2D line into given amount of segments. Includes a gap between the segments. But not at the start or end. Returns an array of 2D Lines. Returns an empty array if the length of the line is less than gap-size x segment-count-minus-1.
Extended Type:
|
|
Divides a 2D line into as few as segments as possible respecting the maximum segment length and the gap. Includes a gap between the segments. But not at the start or end. Returns an array of 2D Lines The input maxSegmentLength is multiplied by factor 0.999999 of to avoid numerical errors. That means in an edge case there are fewer segments returned, not more.
Extended Type:
|
|
Divides a 2D line into as many as segments as possible respecting the minimum segment length and the gap. Includes a gap between the segments. But not at the start or end. Returns an array of 2D Lines The input minSegmentLength is multiplied by factor 1.000001 of to avoid numerical errors. That means in an edge case there are more segments returned, not fewer.
Extended Type:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|