Line
Source: line.js:16
Line shape.
Constructor
new Line(begin: Point2D, end: Point2D): LineParameters
begin(Point2D) — A Point2D representing the beginning of the line.end(Point2D) — A Point2D representing the end of the line.
Instance Methods
getBegin(): Point2D
Get the begin point of the line.
Returns
Point2D— The beginning point of the line.
getEnd(): Point2D
Get the end point of the line.
Returns
Point2D— The ending point of the line.
equals(rhs: Line): boolean
Check for equality.
Parameters
rhs(Line) — The object to compare to.
Returns
boolean— True if both objects are equal.
getDeltaX(): number
Get the line delta in the X direction.
Returns
number— The delta in the X direction.
getDeltaY(): number
Get the line delta in the Y direction.
Returns
number— The delta in the Y direction.
getLength(): number
Get the length of the line.
Returns
number— The length of the line.
getWorldLength(spacing2D: Scalar2D): number
Get the length of the line according to a spacing.
Parameters
spacing2D(Scalar2D) — The 2D spacing.
Returns
number— The length of the line with spacing or null for null spacings.
getMidpoint(): Point2D
Get the mid point of the line.
Since v0.36, please use getCentroid instead.
Returns
Point2D— The mid point of the line.
getCentroid(): Point2D
Get the centroid of the line.
Returns
Point2D— THe centroid point.
contains(point: Point2D, tolerance?: number): boolean
Check if a point is on the line, within a tolerance.
Parameters
point(Point2D) — The point to check.tolerance(number, optional, default: 0) — Optional maximum distance to the line, defaults to 0.
Returns
boolean— True if the point is on the line.
getSlope(): number
Get the slope of the line.
Returns
number— The slope of the line.
getIntercept(): number
Get the intercept of the line.
Returns
number— The slope of the line.
getInclination(): number
Get the inclination of the line.
Returns
number— The inclination of the line.
getFlipped(): Line
Get a new line with the start and end flipped.
Returns
Line— The new flipped line.
quantify(
viewController: ViewController,
): Record.<string, NumberValue>
Quantify a line according to view information.
Parameters
viewController(ViewController) — The associated view controller.
Returns
Record.<string,NumberValue>— A quantification object.