BidimensionalLine
Source: bidimensionalLine.js:13
BidimensionalLine shape. Represents a line with a main (long) axis and a perpendicular (short) axis.
Constructor
new BidimensionalLine(
begin: Point2D,
end: Point2D,
): BidimensionalLineParameters
begin(Point2D) — The beginning point of the main axis.end(Point2D) — The ending point of the main axis.
Instance Methods
getBegin(): Point2D
Get the begin point of the main axis.
Returns
Point2D— The beginning point.
getEnd(): Point2D
Get the end point of the main axis.
Returns
Point2D— The ending point.
getCentroid(): Point2D
Get the centroid (midpoint) of the main axis.
Returns
Point2D— The centroid point.
contains(point: Point2D, tolerance?: number): boolean
Check if a point is on the main or short axis, within a tolerance.
Parameters
point(Point2D) — The point to check.tolerance(number, optional, default: 0) — Optional maximum distance to the axes, defaults to 0.
Returns
boolean— True if the point is on one of the axes.
getLength(): number
Get the length of the main axis.
Returns
number— The length.
getSlope(): number
Get the slope of the main axis.
Returns
number— The slope.
getDeltaX(): number
Get the delta in the X direction for the main axis.
Returns
number— The delta X.
getDeltaY(): number
Get the delta in the Y direction for the main axis.
Returns
number— The delta Y.
quantify(viewController: ViewController): Object
Quantify the bidimensional line according to view information. Returns the length (main axis) and width (short axis) if available.
Parameters
viewController(ViewController) — The associated view controller.
Returns
Object— Quantification object.
Static Methods
restorePropertiesFromQuantification(
annotation: Annotation,
bidim: BidimensionalLine,
quant: object,
)
Restore all bidimensional (short axis) properties from quantification data and a BidimensionalLine instance to the annotation object. This ensures that after loading from a saved drawing, the annotation has all the properties needed for correct display and quantification.
Parameters
annotation(Annotation) — The annotation to update.bidim(BidimensionalLine) — The BidimensionalLine math shape.quant(object) — The quantification object containing saved properties.
Instance Fields
shortAxisLength: number
Optional length of the short axis (perpendicular to main axis).
shortAxisCenter: Point2D | undefined
Optional length of the short axis (perpendicular to main axis).
shortAxisL1: number
Optional length from center to one end of the short axis.
shortAxisL2: number
Optional length from center to the other end of the short axis.
shortAxisT: number
Optional relative position (0-1) of the short axis center along the main axis.
shortAxisCenter: Point2D | undefined
Center of the short axis.
shortAxisT: number | undefined
Short axis T value.
shortAxisL1: number | undefined
Short axis L1 value.
shortAxisL2: number | undefined
Short axis L2 value.
shortAxisLength: number | undefined
Short axis length.
hasShortAxisInteraction: boolean
Indicates if the annotation has short axis interaction.