Header menu logo Euclid

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

this.ClosestParameter

Full Usage: this.ClosestParameter

Parameters:
Returns: float
Modifiers: inline

Returns the parameter at which a point is closest to the (finite) line. The result is between 0.0 and 1.0. Does not fail on very short curves.

Extended Type: Line2D

p : Pt
Returns: float

this.ClosestParameters

Full Usage: this.ClosestParameters

Parameters:
    lnB : Line2D - The second line.

Returns: float * float A tuple of two floats, the first is the parameter on lnA, the second on lnB.

Finds the parameters of closest points between two finite 2D Lines, also works on parallel and overlapping lines.

For parallel and overlapping lines the parameters returned are in the center of their overlap. If the lines intersect the returned parameters are exactly the same. This method uses a default angle tolerance of 0.25 degrees for parallel detection and a length tolerance of 1e-6 for detecting lines that are too short. For more control over these tolerances, use XLine2D.getClosestParameters directly.

Extended Type: Line2D

lnB : Line2D

The second line.

Returns: float * float

A tuple of two floats, the first is the parameter on lnA, the second on lnB.

this.ClosestPoint

Full Usage: this.ClosestPoint

Parameters:
Returns: Pt

Returns closest point on (finite) line. Does not fail on very short curves.

Extended Type: Line2D

p : Pt
Returns: Pt

this.ClosestPoints

Full Usage: this.ClosestPoints

Parameters:
    lnB : Line2D - The second line.

Returns: Pt * Pt A tuple of two Pt, the first is the closest point on lnA, the second on lnB.

Finds the closest points between two finite 2D Lines, also works on parallel and overlapping lines.

For parallel and overlapping lines the points returned are in the center of their overlap. If the lines intersect the returned points are exactly the same. This method uses a default angle tolerance of 0.25 degrees for parallel detection and a length tolerance of 1e-6 for detecting lines that are too short. For more control over these tolerances, use XLine2D.getClosestPoints directly.

Extended Type: Line2D

lnB : Line2D

The second line.

Returns: Pt * Pt

A tuple of two Pt, the first is the closest point on lnA, the second on lnB.

this.DistanceRayPoint

Full Usage: this.DistanceRayPoint

Parameters:
Returns: float
Modifiers: inline

Assumes Line2D to be an infinite ray! Returns distance from point to ray. Fails on curves shorter than 1e-6 units. (ln.DistanceToPt does not.)

Extended Type: Line2D

p : Pt
Returns: float

this.DistanceToPt

Full Usage: this.DistanceToPt

Parameters:
Returns: float
Modifiers: inline

Returns distance from point to (finite) line.

Extended Type: Line2D

p : Pt
Returns: float

this.EvaluateAt

Full Usage: this.EvaluateAt

Parameters:
    p : float

Returns: Pt
Modifiers: inline

Evaluate line at a given parameter (parameters 0.0 to 1.0 are on the line).

Extended Type: Line2D

p : float
Returns: Pt

this.Extend

Full Usage: this.Extend

Parameters:
    distAtStart : float
    distAtEnd : float

Returns: Line2D
Modifiers: inline

Extend 2D line by absolute amount at start and end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
distAtEnd : float
Returns: Line2D

this.ExtendEnd

Full Usage: this.ExtendEnd

Parameters:
    distAtEnd : float

Returns: Line2D
Modifiers: inline

Extend 2D line by absolute amount at end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtEnd : float
Returns: Line2D

this.ExtendEndRel

Full Usage: this.ExtendEndRel

Parameters:
    relAtEnd : float

Returns: Line2D
Modifiers: inline

Extend 2D line by relative amount at end. A relative amount of 0.5 extends the line by half its length. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

relAtEnd : float
Returns: Line2D

this.ExtendRel

Full Usage: this.ExtendRel

Parameters:
    relAtStart : float
    relAtEnd : float

Returns: Line2D
Modifiers: inline

Extend 2D line by relative amount at start and end. A relative amount of 0.5 extends the line by half its length on each side. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

relAtStart : float
relAtEnd : float
Returns: Line2D

this.ExtendStart

Full Usage: this.ExtendStart

Parameters:
    distAtStart : float

Returns: Line2D
Modifiers: inline

Extend 2D line by absolute amount at start. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
Returns: Line2D

this.ExtendStartRel

Full Usage: this.ExtendStartRel

Parameters:
    relAtStart : float

Returns: Line2D
Modifiers: inline

Extend 2D line by relative amount at start. A relative amount of 0.5 extends the line by half its length. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

relAtStart : float
Returns: Line2D

this.IsCoincidentAndOpposingToFast

Full Usage: this.IsCoincidentAndOpposingToFast

Parameters:
    other : Line2D
    parallelogramAreaTolerance : float
    maxDotProduct : float

Returns: bool
Modifiers: inline

A fast version of IsCoincidentAndOpposingTo that uses cross-product to determine parallelism. Checks if two 2D lines are coincident on opposing rays within given tolerances. Lines are coincident if they are parallel (cross product less than parallelogramAreaTolerance) and opposing if the dot-product is negative (smaller than maxDotProduct) and the vector between their start points is also parallel to the lines. The cross product corresponds to the signed area of the parallelogram spanned by the two direction vectors. Lines are opposing if dot product is negative. maxDotProduct must be NEGATIVE! just below zero, -1e-6 by default ! The maxDotProduct helps to make sure FALSE is returned on very short or zero length lines.

Extended Type: Line2D

other : Line2D
parallelogramAreaTolerance : float
maxDotProduct : float
Returns: bool

this.IsCoincidentAndOrientedToFast

Full Usage: this.IsCoincidentAndOrientedToFast

Parameters:
    other : Line2D
    parallelogramAreaTolerance : float
    minDotProduct : float

Returns: bool
Modifiers: inline

A fast version of IsCoincidentAndOrientedTo that uses cross-product to determine parallelism. Checks if two 2D lines are coincident on the same ray within given tolerances. Lines are coincident if they are parallel (cross product less than parallelogramAreaTolerance) and oriented in the same direction if the dot-product is positive (bigger than minDotProduct) and the vector between their start points is also parallel to the lines. The cross product corresponds to the signed area of the parallelogram spanned by the two direction vectors. Lines are oriented if dot product is positive. minDotProduct must be POSITIVE! just above zero. 1e-6 by default. The minDotProduct argument helps to make sure FALSE is returned on very short or zero length lines.

Extended Type: Line2D

other : Line2D
parallelogramAreaTolerance : float
minDotProduct : float
Returns: bool

this.IsCoincidentTo

Full Usage: this.IsCoincidentTo

Parameters:
Returns: bool
Modifiers: inline

Checks if two 2D lines are coincident on the same ray 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 zero Length lines. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minimum Tangent value. See Euclid.Tangent module.

Extended Type: Line2D

other : Line2D
distanceTolerance : float
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsCoincidentToFast

Full Usage: this.IsCoincidentToFast

Parameters:
    other : Line2D
    parallelogramAreaTolerance : float

Returns: bool
Modifiers: inline

A fast version of IsCoincidentTo that uses cross-product to determine parallelism. Checks if two 2D lines are coincident within a given tolerance for their cross product. Lines are coincident if they are parallel (cross product less than parallelogramAreaTolerance) and the vector between their start points is also parallel to the lines. The cross product corresponds to the signed area of the parallelogram spanned by the two direction vectors. ATTENTION this method returns TRUE on zero length or very small lines. It returns FALSE on almost coincident lines that are very long. Pick a bigger parallelogramAreaTolerance for longer lines.

Extended Type: Line2D

other : Line2D
parallelogramAreaTolerance : float
Returns: bool

this.IsNormalTo

Full Usage: this.IsNormalTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12). Alias for ln.IsPerpendicularTo.

Extended Type: Line2D

other : Line2D
maxTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsNormalTo

Full Usage: this.IsNormalTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines or vectors shorter than UtilEuclid.zeroLengthTolerance (1e-12). Alias for ln.IsPerpendicularTo.

Extended Type: Line2D

other : Vc
maxTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsNormalTo

Full Usage: this.IsNormalTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12). Alias for ln.IsPerpendicularTo.

Extended Type: Line2D

other : UnitVc
maxTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelAndOpposingToFast

Full Usage: this.IsParallelAndOpposingToFast

Parameters:
    other : Line2D
    parallelogramAreaTolerance : float
    maxDotProduct : float

Returns: bool
Modifiers: inline

A fast version of IsParallelToAndOpposingTo that uses cross-product to determine parallelism. Checks if two 2D lines are parallel within a given tolerance for their cross product and opposing by having a negative dot-product. Lines are parallel if cross product is less than given parallelogramAreaTolerance. The cross product corresponds to the signed area of the parallelogram spanned by the two direction vectors. Lines are opposing if dot product is negative. maxDotProduct must be NEGATIVE! just below zero, -1e-6 by default ! The maxDotProduct helps to make sure FALSE is returned on very short or zero length lines.

Extended Type: Line2D

other : Line2D
parallelogramAreaTolerance : float
maxDotProduct : float
Returns: bool

this.IsParallelAndOrientedTo

Full Usage: this.IsParallelAndOrientedTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : Line2D
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelAndOrientedTo

Full Usage: this.IsParallelAndOrientedTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines or vectors shorter than 1e-12.

Extended Type: Line2D

other : Vc
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelAndOrientedTo

Full Usage: this.IsParallelAndOrientedTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : UnitVc
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelAndOrientedToFast

Full Usage: this.IsParallelAndOrientedToFast

Parameters:
    other : Line2D
    parallelogramAreaTolerance : float
    minDotProduct : float

Returns: bool
Modifiers: inline

A fast version of IsParallelToAndOrientedTo that uses cross-product to determine parallelism. Checks if two 2D lines are parallel within a given tolerance for their cross product and oriented in the same direction by having a positive dot-product. Lines are parallel if cross product is less than given parallelogramAreaTolerance. The cross product corresponds to the signed area of the parallelogram spanned by the two direction vectors. Lines are oriented if dot product is positive. minDotProduct must be POSITIVE! just above zero. 1e-6 by default. The minDotProduct argument helps to make sure FALSE is returned on very short or zero length lines.

Extended Type: Line2D

other : Line2D
parallelogramAreaTolerance : float
minDotProduct : float
Returns: bool

this.IsParallelTo

Full Usage: this.IsParallelTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : Line2D
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelTo

Full Usage: this.IsParallelTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines or vectors shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : Vc
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelTo

Full Usage: this.IsParallelTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : UnitVc
minTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsParallelToFast

Full Usage: this.IsParallelToFast

Parameters:
    other : Line2D
    parallelogramAreaTolerance : float

Returns: bool
Modifiers: inline

A fast version of IsParallelTo that uses cross-product to determine parallelism. Checks if two 2D lines are parallel within a given tolerance for their cross product. Lines are parallel if cross product is less than parallelogramAreaTolerance. The cross product corresponds to the signed area of the parallelogram spanned by the two direction vectors. ATTENTION this method returns TRUE on zero length or very small lines. It returns FALSE on almost coincident lines that are very long. Pick a bigger parallelogramAreaTolerance for longer lines.

Extended Type: Line2D

other : Line2D
parallelogramAreaTolerance : float
Returns: bool

this.IsPerpendicularTo

Full Usage: this.IsPerpendicularTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : Line2D
maxTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsPerpendicularTo

Full Usage: this.IsPerpendicularTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines or vectors shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : Vc
maxTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsPerpendicularTo

Full Usage: this.IsPerpendicularTo

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

other : UnitVc
maxTangent : float<MeasureProduct<tangent, MeasureOne>>
Returns: bool

this.IsPointOnLeft

Full Usage: this.IsPointOnLeft

Parameters:
Returns: bool
Modifiers: inline

Looking in the direction of the line. Check if a given point is on the left side of the infinite ray. Also returns false if the point is on the line.

Extended Type: Line2D

pt : Pt
Returns: bool

this.IsPointOnRight

Full Usage: this.IsPointOnRight

Parameters:
Returns: bool
Modifiers: inline

Looking in the direction of the line. Check if a given point is on the right side of the ray. Also returns false if the point is on the line.

Extended Type: Line2D

pt : Pt
Returns: bool

this.IsTiny

Full Usage: this.IsTiny

Parameters:
    tol : float

Returns: bool
Modifiers: inline

Returns TRUE if line is shorter than tolerance. Or has NaN components.

Extended Type: Line2D

tol : float
Returns: bool

this.IsTinySq

Full Usage: this.IsTinySq

Parameters:
    tol : float

Returns: bool
Modifiers: inline

Returns TRUE if the line's square length is shorter than squared tolerance. Or has NaN components.

Extended Type: Line2D

tol : float
Returns: bool

this.IsXAligned

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 (axisAlignmentTolerance). Fails on lines shorter than 1e-6.

Extended Type: Line2D

() : unit
Returns: bool

this.IsYAligned

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 (axisAlignmentTolerance). Fails on lines shorter than 1e-6.

Extended Type: Line2D

() : unit
Returns: bool

this.IsZeroLength

Full Usage: this.IsZeroLength

Parameters:
    () : unit

Returns: bool
Modifiers: inline

Check if the line has the same starting and ending point.

Extended Type: Line2D

() : unit
Returns: bool

this.LengthFromParam

Full Usage: this.LengthFromParam

Parameters:
    t : 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: Line2D

t : float
Returns: float

this.LengthTillParam

Full Usage: this.LengthTillParam

Parameters:
    p : 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: Line2D

p : float
Returns: float

this.MatchesOrientation

Full Usage: this.MatchesOrientation

Parameters:
Returns: bool
Modifiers: inline

Checks if the dot product between the two 2D lines is positive . So if the angle between their direction vectors is less than 90 degrees. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

otherLn : Line2D
Returns: bool

this.MatchesOrientation

Full Usage: this.MatchesOrientation

Parameters:
Returns: bool
Modifiers: inline

Checks if the dot product between the a 2D lines and a vector is positive . So if the angle between their direction vectors is less than 90 degrees. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

v : Vc
Returns: bool

this.MatchesOrientation

Full Usage: this.MatchesOrientation

Parameters:
Returns: bool
Modifiers: inline

Checks if the dot product between the a 2D lines and a unit-vector is positive . So if the angle between their direction vectors is less than 90 degrees. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

v : UnitVc
Returns: bool

this.MatchesOrientation45

Full Usage: this.MatchesOrientation45

Parameters:
Returns: bool
Modifiers: inline

Checks if the angle between the two 2D lines is less than 45 degrees. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

l : Line2D
Returns: bool

this.Mid

Full Usage: this.Mid

Parameters:
    () : unit

Returns: Pt
Modifiers: inline

Returns the midpoint of the line,

Extended Type: Line2D

() : unit
Returns: Pt

this.Move

Full Usage: this.Move

Parameters:
Returns: Line2D
Modifiers: inline

Returns a Line2D moved by a vector.

Extended Type: Line2D

v : Vc
Returns: Line2D

this.MoveX

Full Usage: this.MoveX

Parameters:
    distance : float

Returns: Line2D
Modifiers: inline

Returns a Line2D moved by a given distance in X direction.

Extended Type: Line2D

distance : float
Returns: Line2D

this.MoveY

Full Usage: this.MoveY

Parameters:
    distance : float

Returns: Line2D
Modifiers: inline

Returns a Line2D moved by a given distance in Y direction.

Extended Type: Line2D

distance : float
Returns: Line2D

this.RayClosestParameter

Full Usage: this.RayClosestParameter

Parameters:
Returns: float

Assumes the Line2D to be an infinite ray! Returns the parameter at which a point is closest to the ray. If it is smaller than 0.0 or bigger than 1.0 it is outside of the finite line. Fails on curves shorter than 1e-6 units. (ln.ClosestParameter does not)

Extended Type: Line2D

pt : Pt
Returns: float

this.RayClosestPoint

Full Usage: this.RayClosestPoint

Parameters:
Returns: Pt

Assumes Line2D to be an infinite ray! Returns closest point on ray. Fails on curves shorter than 1e-6 units. (ln.ClosestPoint does not.)

Extended Type: Line2D

pt : Pt
Returns: Pt

this.Reversed

Full Usage: this.Reversed

Parameters:
    () : unit

Returns: Line2D
Modifiers: inline

Returns the Line2D reversed.

Extended Type: Line2D

() : unit
Returns: Line2D

this.Rotate

Full Usage: this.Rotate

Parameters:
Returns: Line2D
Modifiers: inline

Rotate a Line2D by a Rotation2D. The resulting line has the same length as the input.

Extended Type: Line2D

r : Rotation2D
Returns: Line2D

this.RotateWithCenter

Full Usage: this.RotateWithCenter

Parameters:
Returns: Line2D
Modifiers: inline

Rotate a Line2D by a Rotation2D around a given center point. The resulting line has the same length as the input.

Extended Type: Line2D

cen : Pt
r : Rotation2D
Returns: Line2D

this.Scale

Full Usage: this.Scale

Parameters:
    factor : float

Returns: Line2D
Modifiers: inline

Scales the 2D line by a given factor. Scale center is World Origin 0,0

Extended Type: Line2D

factor : float
Returns: Line2D

this.ScaleOn

Full Usage: this.ScaleOn

Parameters:
    cen : Pt
    factor : float

Returns: Line2D
Modifiers: inline

Scales the 2D line by a given factor on a given center point

Extended Type: Line2D

cen : Pt
factor : float
Returns: Line2D

this.Segment

Full Usage: this.Segment

Parameters:
    start : float
    ende : float

Returns: Line2D
Modifiers: inline

Evaluate line at given parameters (parameters 0.0 to 1.0 are on the line). Returns a new line from evaluated points. Same as ln.SubLine(start,ende).

Extended Type: Line2D

start : float
ende : float
Returns: Line2D

this.Shrink

Full Usage: this.Shrink

Parameters:
    distAtStart : float
    distAtEnd : float

Returns: Line2D
Modifiers: inline

Shrink 2D line by absolute amount at start and end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
distAtEnd : float
Returns: Line2D

this.ShrinkEnd

Full Usage: this.ShrinkEnd

Parameters:
    distAtEnd : float

Returns: Line2D
Modifiers: inline

Shrink 2D line by absolute amount at end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtEnd : float
Returns: Line2D

this.ShrinkStart

Full Usage: this.ShrinkStart

Parameters:
    distAtStart : float

Returns: Line2D
Modifiers: inline

Shrink 2D line by absolute amount at start. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
Returns: Line2D

this.SqDistanceFromPoint

Full Usage: this.SqDistanceFromPoint

Parameters:
Returns: float

Returns square distance from point to finite line.

Extended Type: Line2D

p : Pt
Returns: float

this.SqDistanceRayPoint

Full Usage: this.SqDistanceRayPoint

Parameters:
Returns: float

Assumes Line2D to be an infinite ray! Returns square distance from point to ray. Fails on curves shorter than 1e-6 units. (ln.DistanceSqFromPoint does not.)

Extended Type: Line2D

p : Pt
Returns: float

this.SubLine

Full Usage: this.SubLine

Parameters:
    start : float
    ende : float

Returns: Line2D
Modifiers: inline

Evaluate line at given parameters (parameters 0.0 to 1.0 are on the line). Returns a new line from evaluated points. Same as ln.Segment(start,ende).

Extended Type: Line2D

start : float
ende : float
Returns: Line2D

Line2D.closestParameter p ln

Full Usage: Line2D.closestParameter p ln

Parameters:
Returns: float
Modifiers: inline

Returns the parameter at which a point is closest to the (finite) line. The result is between 0.0 and 1.0.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: float

Line2D.closestParameters lnA lnB

Full Usage: Line2D.closestParameters lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: float * float A tuple of two floats, the first is the parameter on lnA, the second on lnB

Finds the parameters of closest points between two finite 2D Lines, also works on parallel and overlapping lines.

For parallel and overlapping lines the parameters returned are in the center of their overlap. If the lines intersect the returned parameters are exactly the same

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: float * float

A tuple of two floats, the first is the parameter on lnA, the second on lnB

Line2D.closestPoint p ln

Full Usage: Line2D.closestPoint p ln

Parameters:
Returns: Pt
Modifiers: inline

Returns closest point on (finite) line.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: Pt

Line2D.closestPoints lnA lnB

Full Usage: Line2D.closestPoints lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: Pt * Pt

Finds the closest points between two finite 2D Lines, also works on parallel and overlapping lines.

For parallel and overlapping lines the points returned are in the center of their overlap. If the lines intersect the returned points are exactly the same

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: Pt * Pt

Line2D.createFromLine3D ln

Full Usage: Line2D.createFromLine3D ln

Parameters:
Returns: Line2D
Modifiers: inline

Creates a 2D line from a 3D line by projecting onto the XY plane. The Z coordinate is discarded.

Extended Type: Line2D

ln : Line3D
Returns: Line2D

Line2D.createFromPtAndVc (p, v)

Full Usage: Line2D.createFromPtAndVc (p, v)

Parameters:
Returns: Line2D
Modifiers: inline

Creates a 2D line starting at given point and going to along the given vector.

Extended Type: Line2D

p : Pt
v : Vc
Returns: Line2D

Line2D.createFromVec v

Full Usage: Line2D.createFromVec v

Parameters:
Returns: Line2D
Modifiers: inline

Creates a 2D line starting at World Origin and going to along the given vector.

Extended Type: Line2D

v : Vc
Returns: Line2D

Line2D.cross a b

Full Usage: Line2D.cross a b

Parameters:
Returns: float
Modifiers: inline

Returns the Cross Product or Determinant between the vectors of the Two lines. In 2D it is just a scalar equal to the signed area of the parallelogram spanned by the input vectors. If the result is zero the two lines are parallel (or one line is zero-length). Same as Line2D.det

Extended Type: Line2D

a : Line2D
b : Line2D
Returns: float

Line2D.det a b

Full Usage: Line2D.det a b

Parameters:
Returns: float
Modifiers: inline

Returns the Cross Product or Determinant between the vectors of the Two lines. In 2D it is just a scalar equal to the signed area of the parallelogram spanned by the input vectors. If the result is zero the two lines are parallel (or one line is zero-length). Same as Line2D.cross.

Extended Type: Line2D

a : Line2D
b : Line2D
Returns: float

Line2D.direction ln

Full Usage: Line2D.direction ln

Parameters:
Returns: Vc
Modifiers: inline

Same as Line2D.vector or Line2D.tangent. The returned vector has the same length as the Line2D.

Extended Type: Line2D

ln : Line2D
Returns: Vc

Line2D.distanceRayPoint p ln

Full Usage: Line2D.distanceRayPoint p ln

Parameters:
Returns: float
Modifiers: inline

Assumes Line2D to be an infinite ray! Returns distance from point to ray.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: float

Line2D.distanceToLine lnA lnB

Full Usage: Line2D.distanceToLine lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: float The distance between the two lines. No matter if they are zero length or parallel

Computes the distance between two finite 2D lines.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: float

The distance between the two lines. No matter if they are zero length or parallel

Line2D.distanceToPt p ln

Full Usage: Line2D.distanceToPt p ln

Parameters:
Returns: float
Modifiers: inline

Returns distance from point to (finite) line.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: float

Line2D.divide segments ln

Full Usage: Line2D.divide segments ln

Parameters:
Returns: Pt[]

Divides a 2D line into given amount of segments. Returns an array of 2D points of length: segment count + 1. Includes start and endpoint of line.

Extended Type: Line2D

segments : int
ln : Line2D
Returns: Pt[]

Line2D.divideEvery dist l

Full Usage: Line2D.divideEvery dist l

Parameters:
Returns: ResizeArray<Pt>

Divides a 2D line into segments of given length. Includes start and end point. If the line length is smaller than the given distance just the start and end point is returned. Adds end point only if there is a remainder bigger than 0.1% of the segment length.

Extended Type: Line2D

dist : float
l : Line2D
Returns: ResizeArray<Pt>

Line2D.divideInsideEvery dist l

Full Usage: Line2D.divideInsideEvery dist l

Parameters:
Returns: ResizeArray<Pt>

Divides a 2D line into segments of given length. Excludes start and end point. If the line length is smaller than the given distance an empty array is returned. Adds last div point before end only if there is a remainder bigger than 0.1% of the segment length.

Extended Type: Line2D

dist : float
l : Line2D
Returns: ResizeArray<Pt>

Line2D.divideMaxLength maxSegmentLength ln

Full Usage: Line2D.divideMaxLength maxSegmentLength ln

Parameters:
    maxSegmentLength : float
    ln : Line2D

Returns: Pt[]

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: Line2D

maxSegmentLength : float
ln : Line2D
Returns: Pt[]

Line2D.divideMinLength minSegmentLength ln

Full Usage: Line2D.divideMinLength minSegmentLength ln

Parameters:
    minSegmentLength : float
    ln : Line2D

Returns: Pt[]

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: Line2D

minSegmentLength : float
ln : Line2D
Returns: Pt[]

Line2D.doIntersect lnA lnB

Full Usage: Line2D.doIntersect lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: bool

A fast test tests if two finite 2D lines truly intersect. Does not use a default tolerance for parallel or coincident lines. Just checks within line range and not NaN. Returns false on zero length lines or if parallel lines are touching or overlapping each other.

Use the XLine2D module for more specialized intersection calculations. Like getting the kind of Parallel relation between lines, only getting the parameter of one line, or setting a tolerance for when lines are parallel or coincident. This does not check for an explicit angle tolerance, so overlapping almost parallel lines may return true.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: bool

Line2D.doIntersectOrOverlap lnA lnB

Full Usage: Line2D.doIntersectOrOverlap lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: bool

Tests if two finite 2D lines intersect or touch. Also returns true if parallel lines are touching or overlapping each other. Also returns true if a zero length lines are at the same location.

This method uses an angle of 0.25 degrees to classify Lines as parallel. In wich case it also checks if they overlap or touch. Use the Euclid's XLine2D module for more specialized intersection calculations. Like getting the kind of Parallel relation between lines, only getting the parameter of one line, or setting a tolerance for when lines are parallel or coincident.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: bool

Line2D.ende l

Full Usage: Line2D.ende l

Parameters:
Returns: Pt
Modifiers: inline

Returns the End point of the line. Same as Line2D.to'

Extended Type: Line2D

l : Line2D
Returns: Pt

Line2D.equals tol a b

Full Usage: Line2D.equals tol a b

Parameters:
Returns: bool
Modifiers: inline

Checks if two 2D lines are equal within tolerance. Identical Lines in opposite directions are not considered equal. Use a tolerance of 0.0 to check for an exact match.

Extended Type: Line2D

tol : float
a : Line2D
b : Line2D
Returns: bool

Line2D.evaluateAt t ln

Full Usage: Line2D.evaluateAt t ln

Parameters:
Returns: Pt
Modifiers: inline

Evaluate line at a given parameter ( parameters 0.0 to 1.0 are on the line)

Extended Type: Line2D

t : float
ln : Line2D
Returns: Pt

Line2D.extend distAtStart distAtEnd ln

Full Usage: Line2D.extend distAtStart distAtEnd ln

Parameters:
    distAtStart : float
    distAtEnd : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Extend 2D line by absolute amount at start and end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
distAtEnd : float
ln : Line2D
Returns: Line2D

Line2D.extendEnd distAtEnd ln

Full Usage: Line2D.extendEnd distAtEnd ln

Parameters:
    distAtEnd : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Extend 2D line by absolute amount at end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtEnd : float
ln : Line2D
Returns: Line2D

Line2D.extendEndRel relAtEnd ln

Full Usage: Line2D.extendEndRel relAtEnd ln

Parameters:
    relAtEnd : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Extend 2D line by relative amount at end. A relative amount of 0.5 extends the line by half its length. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

relAtEnd : float
ln : Line2D
Returns: Line2D

Line2D.extendRel relAtStart relAtEnd ln

Full Usage: Line2D.extendRel relAtStart relAtEnd ln

Parameters:
    relAtStart : float
    relAtEnd : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Extend 2D line by relative amount at start and end. A relative amount of 0.5 extends the line by half its length on each side. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

relAtStart : float
relAtEnd : float
ln : Line2D
Returns: Line2D

Line2D.extendStart distAtStart ln

Full Usage: Line2D.extendStart distAtStart ln

Parameters:
    distAtStart : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Extend 2D line by absolute amount at start. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
ln : Line2D
Returns: Line2D

Line2D.extendStartRel relAtStart ln

Full Usage: Line2D.extendStartRel relAtStart ln

Parameters:
    relAtStart : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Extend 2D line by relative amount at start. A relative amount of 0.5 extends the line by half its length. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

relAtStart : float
ln : Line2D
Returns: Line2D

Line2D.flip ln

Full Usage: Line2D.flip ln

Parameters:
Returns: Line2D
Modifiers: inline

Reverse or flip the Line2D (same as Line2D.reverse)

Extended Type: Line2D

ln : Line2D
Returns: Line2D

Line2D.from l

Full Usage: Line2D.from l

Parameters:
Returns: Pt
Modifiers: inline

Returns the Start point of the line. Same as Line2D.start.

Extended Type: Line2D

l : Line2D
Returns: Pt

Line2D.fromX l

Full Usage: Line2D.fromX l

Parameters:
Returns: float
Modifiers: inline

Returns the Start point's X coordinate of the line.

Extended Type: Line2D

l : Line2D
Returns: float

Line2D.fromY l

Full Usage: Line2D.fromY l

Parameters:
Returns: float
Modifiers: inline

Returns the Start point's Y coordinate of the line.

Extended Type: Line2D

l : Line2D
Returns: float

Line2D.isCoincidentTo a b

Full Usage: Line2D.isCoincidentTo a b

Parameters:
Returns: bool
Modifiers: inline

Checks if two 2D lines are coincident on the same ray within tolerance. This means that lines are parallel within 0.25 degrees and the distance of second start point to the first line is less than 1e-6.

Extended Type: Line2D

a : Line2D
b : Line2D
Returns: bool

Line2D.isNormalTo lnA lnB

Full Usage: Line2D.isNormalTo lnA lnB

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12). Same as Line2D.isNormalTo

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isNormalTo' lnA lnB

Full Usage: Line2D.isNormalTo' lnA lnB

Parameters:
Returns: bool
Modifiers: inline

A faster Check if two 2D lines are perpendicular to each other. The angle tolerance is 89.75 to 90.25 degrees. This function does not do a check for very short lines. But will return false on zero-length lines. Same as Line2D.isPerpendicularTo'

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isNotParallelTo lnA lnB

Full Usage: Line2D.isNotParallelTo lnA lnB

Parameters:
Returns: bool
Modifiers: inline

Checks if two 2D lines are Not parallel. Ignoring orientation. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isNotParallelTo' lnA lnB

Full Usage: Line2D.isNotParallelTo' lnA lnB

Parameters:
Returns: bool
Modifiers: inline

A faster Check if two 2D lines are not parallel. Ignoring orientation. The angle tolerance is 0.25 degrees. This function does not do a check for very short lines. But will return false on zero-length lines.

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isParallelAndOrientedTo lnA lnB

Full Usage: Line2D.isParallelAndOrientedTo lnA lnB

Parameters:
Returns: bool
Modifiers: inline

Checks if two 2D lines are parallel and orientated the same way. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isParallelTo lnA lnB

Full Usage: Line2D.isParallelTo lnA lnB

Parameters:
Returns: bool
Modifiers: inline

Checks if two 2D lines are parallel. Ignoring orientation. The default angle tolerance is 0.25 degrees. This tolerance can be customized by an optional minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isParallelTo' lnA lnB

Full Usage: Line2D.isParallelTo' lnA lnB

Parameters:
Returns: bool
Modifiers: inline

A faster Check if two 2D lines are parallel. Ignoring orientation. The angle tolerance is 0.25 degrees. This function does not do a check for very short lines. But will return false on zero-length lines.

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isPerpendicularTo lnA lnB

Full Usage: Line2D.isPerpendicularTo lnA lnB

Parameters:
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 minimum Tangent value. See Euclid.Tangent module. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12). Same as Line2D.isNormalTo

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isPerpendicularTo' lnA lnB

Full Usage: Line2D.isPerpendicularTo' lnA lnB

Parameters:
Returns: bool
Modifiers: inline

A faster Check if two 2D lines are perpendicular to each other. The angle tolerance is 89.75 to 90.25 degrees. This function does not do a check for very short lines. But will return false on zero-length lines. Same as Line2D.isNormalTo'

Extended Type: Line2D

lnA : Line2D
lnB : Line2D
Returns: bool

Line2D.isTiny tol l

Full Usage: Line2D.isTiny tol l

Parameters:
Returns: bool
Modifiers: inline

Check if line is shorter than tolerance. Or contains a NaN value

Extended Type: Line2D

tol : float
l : Line2D
Returns: bool

Line2D.isTinySq tol l

Full Usage: Line2D.isTinySq tol l

Parameters:
Returns: bool
Modifiers: inline

Check if line is shorter than squared tolerance. Or contains a NaN value

Extended Type: Line2D

tol : float
l : Line2D
Returns: bool

Line2D.isTouchingEndOf squareTolerance a b

Full Usage: Line2D.isTouchingEndOf squareTolerance a b

Parameters:
    squareTolerance : float - The squared tolerance for the distance between the end points.
    a : Line2D - The first line.
    b : Line2D - The second line.

Returns: bool

Checks if the two finite 2D lines are touching each other at any of end points within the given tolerance. This will also return TRUE if the lines are touching on both points.

Use getEndsTouching to get more detailed information about which ends are touching.

Extended Type: Line2D

squareTolerance : float

The squared tolerance for the distance between the end points.

a : Line2D

The first line.

b : Line2D

The second line.

Returns: bool

Line2D.isXAligned l

Full Usage: Line2D.isXAligned l

Parameters:
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 (axisAlignmentTolerance). Fails on lines shorter than 1e-6.

Extended Type: Line2D

l : Line2D
Returns: bool

Line2D.isYAligned l

Full Usage: Line2D.isYAligned l

Parameters:
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 (axisAlignmentTolerance). Fails on lines shorter than 1e-6.

Extended Type: Line2D

l : Line2D
Returns: bool

Line2D.isZeroLength l

Full Usage: Line2D.isZeroLength l

Parameters:
Returns: bool
Modifiers: inline

Check if the line has same starting and ending point.

Extended Type: Line2D

l : Line2D
Returns: bool

Line2D.length l

Full Usage: Line2D.length l

Parameters:
Returns: float
Modifiers: inline

Returns the length of the line.

Extended Type: Line2D

l : Line2D
Returns: float

Line2D.lengthSq l

Full Usage: Line2D.lengthSq l

Parameters:
Returns: float
Modifiers: inline

Returns the square length of the line.

Extended Type: Line2D

l : Line2D
Returns: float

Line2D.lengthToPtOnLine line pt

Full Usage: Line2D.lengthToPtOnLine line pt

Parameters:
Returns: float
Modifiers: inline

Get distance from start of line to point projected onto line, may be negative.

Extended Type: Line2D

line : Line2D
pt : Pt
Returns: float

Line2D.matchOrientation orientationToMatch lineToFlip

Full Usage: Line2D.matchOrientation orientationToMatch lineToFlip

Parameters:
Returns: Line2D
Modifiers: inline

Ensure 2D line has a positive dot product with given orientation line.

Extended Type: Line2D

orientationToMatch : Line2D
lineToFlip : Line2D
Returns: Line2D

Line2D.matchUnitVcOrientation orientationToMatch lineToFlip

Full Usage: Line2D.matchUnitVcOrientation orientationToMatch lineToFlip

Parameters:
Returns: Line2D
Modifiers: inline

Ensure 2D line has a positive dot product with given orientation 2D vector.

Extended Type: Line2D

orientationToMatch : UnitVc
lineToFlip : Line2D
Returns: Line2D

Line2D.matchVcOrientation orientationToMatch lineToFlip

Full Usage: Line2D.matchVcOrientation orientationToMatch lineToFlip

Parameters:
    orientationToMatch : Vc
    lineToFlip : Line2D

Returns: Line2D
Modifiers: inline

Ensure 2D line has a positive dot product with given orientation 2D vector.

Extended Type: Line2D

orientationToMatch : Vc
lineToFlip : Line2D
Returns: Line2D

Line2D.matchesOrientation l ln

Full Usage: Line2D.matchesOrientation l ln

Parameters:
Returns: bool
Modifiers: inline

Checks if the dot product between the a 2D lines and a unit-vector is positive . So if the angle between their direction vectors is less than 90 degrees. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

l : Line2D
ln : Line2D
Returns: bool

Line2D.matchesOrientation45 l ln

Full Usage: Line2D.matchesOrientation45 l ln

Parameters:
Returns: bool
Modifiers: inline

Checks if the angle between the two 2D lines is less than 45 degrees. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

l : Line2D
ln : Line2D
Returns: bool

Line2D.mid ln

Full Usage: Line2D.mid ln

Parameters:
Returns: Pt
Modifiers: inline

Get point at center of line.

Extended Type: Line2D

ln : Line2D
Returns: Pt

Line2D.move v ln

Full Usage: Line2D.move v ln

Parameters:
Returns: Line2D
Modifiers: inline

Move a Line2D by a vector. (same as Line2D.translate)

Extended Type: Line2D

v : Vc
ln : Line2D
Returns: Line2D

Line2D.moveX distance ln

Full Usage: Line2D.moveX distance ln

Parameters:
    distance : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Returns a Line2D moved by a given distance in X direction.

Extended Type: Line2D

distance : float
ln : Line2D
Returns: Line2D

Line2D.moveY distance ln

Full Usage: Line2D.moveY distance ln

Parameters:
    distance : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Returns a Line2D moved by a given distance in Y direction.

Extended Type: Line2D

distance : float
ln : Line2D
Returns: Line2D

Line2D.notEquals tol a b

Full Usage: Line2D.notEquals tol a b

Parameters:
Returns: bool

Check if two 2D lines are not equal within a given tolerance. Use a tolerance of 0.0 to check if the two 2D-lines are not exactly equal.

Extended Type: Line2D

tol : float
a : Line2D
b : Line2D
Returns: bool

Line2D.offset distance ln

Full Usage: Line2D.offset distance ln

Parameters:
    distance : float
    ln : Line2D

Returns: Line2D

Offset line in XY-Plane to left side in line direction. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12). If amount is 0.0 no offset is computed and the input line is returned.

Extended Type: Line2D

distance : float
ln : Line2D
Returns: Line2D

Line2D.pointAtDistance dist ln

Full Usage: Line2D.pointAtDistance dist ln

Parameters:
Returns: Pt
Modifiers: inline

Finds point at given distance from line start. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

dist : float
ln : Line2D
Returns: Pt

Line2D.projectOntoRay rayToProjectOnto lineToProject

Full Usage: Line2D.projectOntoRay rayToProjectOnto lineToProject

Parameters:
Returns: Line2D

Project a line onto another line considered infinite in both directions.

Extended Type: Line2D

rayToProjectOnto : Line2D
lineToProject : Line2D
Returns: Line2D

Line2D.projectOntoRayParam rayToProjectOnto lineToProject

Full Usage: Line2D.projectOntoRayParam rayToProjectOnto lineToProject

Parameters:
Returns: float * float

Project a line onto another line considered infinite in both directions. Returns the start and end parameters of the projected line on the target line.

Extended Type: Line2D

rayToProjectOnto : Line2D
lineToProject : Line2D
Returns: float * float

Line2D.rayClosestParameter p ln

Full Usage: Line2D.rayClosestParameter p ln

Parameters:
Returns: float
Modifiers: inline

Assumes Line2D to be an infinite ray! Returns the parameter at which a point is closest to the infinite ray. If it is smaller than 0.0 or bigger than 1.0 it is outside of the finite line.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: float

Line2D.rayClosestPoint p ln

Full Usage: Line2D.rayClosestPoint p ln

Parameters:
Returns: Pt
Modifiers: inline

Assumes Line2D to be an infinite ray! Returns closest point on ray.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: Pt

Line2D.reverse ln

Full Usage: Line2D.reverse ln

Parameters:
Returns: Line2D
Modifiers: inline

Reverse or flip the Line2D (same as Line2D.flip)

Extended Type: Line2D

ln : Line2D
Returns: Line2D

Line2D.rotate r ln

Full Usage: Line2D.rotate r ln

Parameters:
Returns: Line2D
Modifiers: inline

Rotation a Line2D.

Extended Type: Line2D

r : Rotation2D
ln : Line2D
Returns: Line2D

Line2D.rotateWithCenter cen r ln

Full Usage: Line2D.rotateWithCenter cen r ln

Parameters:
Returns: Line2D
Modifiers: inline

Rotation a Line2D around a given Center.

Extended Type: Line2D

cen : Pt
r : Rotation2D
ln : Line2D
Returns: Line2D

Line2D.scale factor ln

Full Usage: Line2D.scale factor ln

Parameters:
Returns: Line2D
Modifiers: inline

Scale the 2D line by a given factor. Scale center is World Origin 0,0

Extended Type: Line2D

factor : float
ln : Line2D
Returns: Line2D

Line2D.segment start ende ln

Full Usage: Line2D.segment start ende ln

Parameters:
    start : float
    ende : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Returns new Line2D from point at Parameter a to point at Parameter b. Same as Line2D.subLine

Extended Type: Line2D

start : float
ende : float
ln : Line2D
Returns: Line2D

Line2D.setEnd pt ln

Full Usage: Line2D.setEnd pt ln

Parameters:
Returns: Line2D
Modifiers: inline

Set Line2D end point, returns a new line.

Extended Type: Line2D

pt : Pt
ln : Line2D
Returns: Line2D

Line2D.setStart pt ln

Full Usage: Line2D.setStart pt ln

Parameters:
Returns: Line2D
Modifiers: inline

Set Line2D start point, returns a new line.

Extended Type: Line2D

pt : Pt
ln : Line2D
Returns: Line2D

Line2D.shrink distAtStart distAtEnd ln

Full Usage: Line2D.shrink distAtStart distAtEnd ln

Parameters:
    distAtStart : float
    distAtEnd : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Shrink 2D line by absolute amount at start and end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
distAtEnd : float
ln : Line2D
Returns: Line2D

Line2D.shrinkEnd distAtEnd ln

Full Usage: Line2D.shrinkEnd distAtEnd ln

Parameters:
    distAtEnd : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Shrink 2D line by absolute amount at end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtEnd : float
ln : Line2D
Returns: Line2D

Line2D.shrinkStart distAtStart ln

Full Usage: Line2D.shrinkStart distAtStart ln

Parameters:
    distAtStart : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Shrink 2D line by absolute amount at start. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

distAtStart : float
ln : Line2D
Returns: Line2D

Line2D.split gap segments ln

Full Usage: Line2D.split gap segments ln

Parameters:
    gap : float
    segments : int
    ln : Line2D

Returns: Line2D[]

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: Line2D

gap : float
segments : int
ln : Line2D
Returns: Line2D[]

Line2D.splitMaxLength gap maxSegmentLength ln

Full Usage: Line2D.splitMaxLength gap maxSegmentLength ln

Parameters:
    gap : float
    maxSegmentLength : float
    ln : Line2D

Returns: Line2D[]

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: Line2D

gap : float
maxSegmentLength : float
ln : Line2D
Returns: Line2D[]

Line2D.splitMinLength gap minSegmentLength ln

Full Usage: Line2D.splitMinLength gap minSegmentLength ln

Parameters:
    gap : float
    minSegmentLength : float
    ln : Line2D

Returns: Line2D[]

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: Line2D

gap : float
minSegmentLength : float
ln : Line2D
Returns: Line2D[]

Line2D.sqDistanceFromPoint p ln

Full Usage: Line2D.sqDistanceFromPoint p ln

Parameters:
Returns: float
Modifiers: inline

Returns the square distance from point to finite line.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: float

Line2D.sqDistanceRayPoint p ln

Full Usage: Line2D.sqDistanceRayPoint p ln

Parameters:
Returns: float
Modifiers: inline

Assumes Line2D to be an infinite ray! Returns the square distance from point to ray.

Extended Type: Line2D

p : Pt
ln : Line2D
Returns: float

Line2D.sqDistanceToLine lnA lnB

Full Usage: Line2D.sqDistanceToLine lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: float The squared distance between the two lines. No matter if they are zero length or parallel

Computes the squared distance between two finite 2D lines.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: float

The squared distance between the two lines. No matter if they are zero length or parallel

Line2D.start l

Full Usage: Line2D.start l

Parameters:
Returns: Pt
Modifiers: inline

Returns the Start point of the line. Same as Line2D.from.

Extended Type: Line2D

l : Line2D
Returns: Pt

Line2D.subLine start ende ln

Full Usage: Line2D.subLine start ende ln

Parameters:
    start : float
    ende : float
    ln : Line2D

Returns: Line2D
Modifiers: inline

Returns new Line2D from point at Parameter a to point at Parameter b. Same as Line2D.segment

Extended Type: Line2D

start : float
ende : float
ln : Line2D
Returns: Line2D

Line2D.tangent ln

Full Usage: Line2D.tangent ln

Parameters:
Returns: Vc
Modifiers: inline

Same as Line2D.vector or Line2D.direction. The returned vector has the same length as the Line2D.

Extended Type: Line2D

ln : Line2D
Returns: Vc

Line2D.to' l

Full Usage: Line2D.to' l

Parameters:
Returns: Pt
Modifiers: inline

Returns the End point of the line. Same as Line2D.ende.

Extended Type: Line2D

l : Line2D
Returns: Pt

Line2D.toLine3D zLevel ln

Full Usage: Line2D.toLine3D zLevel ln

Parameters:
Returns: Line3D
Modifiers: inline

Creates a 3D line from a 2D line with Z coordinates set to the specified level. The default zLevel is 0.0 if not provided.

Extended Type: Line2D

zLevel : float
ln : Line2D
Returns: Line3D

Line2D.toX l

Full Usage: Line2D.toX l

Parameters:
Returns: float
Modifiers: inline

Returns the End point's X coordinate of the line.

Extended Type: Line2D

l : Line2D
Returns: float

Line2D.toY l

Full Usage: Line2D.toY l

Parameters:
Returns: float
Modifiers: inline

Returns the End point's Y coordinate of the line.

Extended Type: Line2D

l : Line2D
Returns: float

Line2D.translate v ln

Full Usage: Line2D.translate v ln

Parameters:
Returns: Line2D
Modifiers: inline

Move a Line2D by a vector. (same as Line2D.move)

Extended Type: Line2D

v : Vc
ln : Line2D
Returns: Line2D

Line2D.tryGetOverlap lnA lnB

Full Usage: Line2D.tryGetOverlap lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: (float * float) option An option of a tuple of two floats. Returns the tuple containing the start and end parameter of the overlap on lnA if the lines are parallel and overlapping. Returns None if the lines are not parallel, not overlapping, our just touching at ends,or too short.

Checks if lines are parallel, coincident and overlapping.

If the first parameter in the overlap is smaller than the second the lines are oriented in the same direction. If the first parameter is greater than the second the lines are oriented in the opposite direction.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: (float * float) option

An option of a tuple of two floats. Returns the tuple containing the start and end parameter of the overlap on lnA if the lines are parallel and overlapping. Returns None if the lines are not parallel, not overlapping, our just touching at ends,or too short.

Line2D.tryIntersect lnA lnB

Full Usage: Line2D.tryIntersect lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: Pt option A Pt if the lines intersect truly, None if apart, lines too short or if parallel lines are touching or overlapping each other.

A fast intersection of two finite 2D lines. Does not use a default tolerance for parallel or coincident lines. Just checks if both parameters are within line range and not NaN.

Use the XLine2D module for more specialized intersection calculations. Like getting the kind of Parallel relation between lines, only getting the parameter of one line, or setting a tolerance for when lines are parallel or coincident.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: Pt option

A Pt if the lines intersect truly, None if apart, lines too short or if parallel lines are touching or overlapping each other.

Line2D.tryIntersectOrOverlap lnA lnB

Full Usage: Line2D.tryIntersectOrOverlap lnA lnB

Parameters:
    lnA : Line2D - The first line.
    lnB : Line2D - The second line.

Returns: Pt option An option of Pt If the lines are coincident and overlapping this point is in the center of their overlap.

Intersects two finite 2D Lines. Also returns a point if parallel lines are touching or overlapping each other. Also returns a point a zero length lines are at the same location within 1e-6 distance.

This method uses an angle of 0.25 degrees to classify Lines as parallel. In wich case it also checks if they overlap or touch. Use the Euclid's XLine2D module for more specialized intersection calculations. Like getting the kind of Parallel relation between lines, only getting the parameter of one line, or setting a tolerance for when lines are parallel or coincident.

Extended Type: Line2D

lnA : Line2D

The first line.

lnB : Line2D

The second line.

Returns: Pt option

An option of Pt If the lines are coincident and overlapping this point is in the center of their overlap.

Line2D.tryIntersectRay lineA lineB

Full Usage: Line2D.tryIntersectRay lineA lineB

Parameters:
    lineA : Line2D - First line.
    lineB : Line2D - Second line.

Returns: Pt option The point at which the two rays intersect or None.

Tries to get intersection point of two rays (rays are 2D lines extended infinitely).

If the lines are parallel or coincident, or if the parameter on Line A is bigger than 1e12 in absolute value, None is returned.

Extended Type: Line2D

lineA : Line2D

First line.

lineB : Line2D

Second line.

Returns: Pt option

The point at which the two rays intersect or None.

Line2D.tryProjectOntoLine onToLine lineToProject

Full Usage: Line2D.tryProjectOntoLine onToLine lineToProject

Parameters:
Returns: Line2D option

Tries to a line onto another line considered finite. Returns Some Line2D if there is an overlap. Returns None if there is no overlap. Keeps the orientation of the line to project.

Extended Type: Line2D

onToLine : Line2D
lineToProject : Line2D
Returns: Line2D option

Line2D.tryProjectOntoLineParam onToLine lineToProject

Full Usage: Line2D.tryProjectOntoLineParam onToLine lineToProject

Parameters:
Returns: (float * float) option

Tries to project a line onto another line considered finite. Returns None if there is no overlap. Returns Some (startParam, endParam) if there is an overlap. The parameters are between 0.0 and 1.0 on the target line The first parameter is from the start of the line to project. The second parameter is from the end of the line to project. So the if the first parameter is bigger than the second, the lines are oriented in opposite direction.

Extended Type: Line2D

onToLine : Line2D
lineToProject : Line2D
Returns: (float * float) option

Line2D.unitTangent ln

Full Usage: Line2D.unitTangent ln

Parameters:
Returns: UnitVc
Modifiers: inline

Returns a unit-vector of the line Direction.

Extended Type: Line2D

ln : Line2D
Returns: UnitVc

Line2D.vector ln

Full Usage: Line2D.vector ln

Parameters:
Returns: Vc
Modifiers: inline

Same as Line2D.tangent or Line2D.direction. The returned vector has the same length as the Line2D.

Extended Type: Line2D

ln : Line2D
Returns: Vc

Line2D.withLengthFromMid len ln

Full Usage: Line2D.withLengthFromMid len ln

Parameters:
Returns: Line2D
Modifiers: inline

Returns new Line2D with given length. Fixed in the midpoint. Missing length is added to or subtracted from both the end and start of the line. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

len : float
ln : Line2D
Returns: Line2D

Line2D.withLengthFromStart len ln

Full Usage: Line2D.withLengthFromStart len ln

Parameters:
Returns: Line2D
Modifiers: inline

Returns new Line2D with given length, going out from start in direction of end. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

len : float
ln : Line2D
Returns: Line2D

Line2D.withLengthToEnd len ln

Full Usage: Line2D.withLengthToEnd len ln

Parameters:
Returns: Line2D
Modifiers: inline

Returns new Line2D ending at current LineEnd with given length coming from direction of start. Fails on lines shorter than UtilEuclid.zeroLengthTolerance (1e-12).

Extended Type: Line2D

len : float
ln : Line2D
Returns: Line2D

Type something to start searching.