Types - Annotation
API reference for ./geometry/annotation, ./evaluate/annotation on @huukhanhnguyen/types.
See the Guide for the package's role.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
AngularDimension
type
An angle measured at center, between the arms running out to references.
references is the same CHAIN as LinearDimension's: N+1 arms give N measured angles, and every element has the same role.
arcPoint does two jobs that a bare radius number cannot: it sets the dimension arc's radius (its distance from center), and it picks WHICH of the four angles two crossing arms subtend is the one meant — the quadrant it falls in is the answer.
Sniff: "center" in geometry && "arcPoint" in geometry.
type AngularDimension
// = {
center: Point;
references: Point[];
arcPoint: Point;
}AngularDimensionEntity
type
type AngularDimensionEntity
// = EntityBase & DimensionEntityFields & { geometry: AngularDimension; }Annotation
type
Union of the drafting geometries (an entity's geometry field).
type Annotation
// = LinearDimension | RadialDimension | AngularDimension | Text | Leader | ImageAnnotationEntity
type
Union of the drafting entity shapes.
type AnnotationEntity
// = LinearDimensionEntity | RadialDimensionEntity | AngularDimensionEntity | TextEntity | LeaderEntity | ImageEntityImageEntity
type
type ImageEntity
// = EntityBase & { geometry: Image; }Leader
type
A pointer: one or more arrowheads at targets, joined to a landing where something is written.
targets is plural because one leader routinely points at several things (three identical bolts, one note). It carries no text of its own: the text is a TextEntity in the leader entity's drawn entities, so there is exactly one place a string on a drawing lives.
Sniff: "targets" in geometry && "landing" in geometry.
type Leader
// = {
targets: Point[];
landing: Point;
}LeaderEntity
type
A pointer with its drawn form. The text it points WITH is a TextEntity inside entities, never a field here.
type LeaderEntity
// = EntityBase & { geometry: Leader; style: string; entities: Entity[]; }LinearDimension
type
A distance measured between marks, drawn on a dimension line.
references is a CHAIN, not a bag: N+1 marks give N measured segments, so a single dimension is a chain of one and needs no separate type, and a running / chained dimension needs no second type either. Every element has the SAME role — which is exactly what the old anchors could not say.
linePoint is a point the dimension LINE passes through: the offset from the references is geometry, not a number to guess a sign for.
direction absent means measure ALONG the references (the ordinary case). Present, it measures the projection onto that direction — an aligned dimension becomes an axis-aligned one without a second type.
Sniff: "references" in geometry && "linePoint" in geometry.
type LinearDimension
// = {
references: Point[];
linePoint: Point;
direction?: Vector;
}LinearDimensionEntity
type
type LinearDimensionEntity
// = EntityBase & DimensionEntityFields & { geometry: LinearDimension; }RadialDimension
type
A radius (or diameter) measured on a circle or circular arc.
The measured subject is an ArcCurve because that type ALREADY carries centre, radius, plane normal and both axes — a centre plus a rim point cannot determine a circle in space (infinitely many circles pass through one point about one centre), so the arc is the only honest carrier.
angle (radians, in the arc's own xAxis/yAxis frame) locates the leader ON the arc. It is an angle and not a point on purpose: an angle is always valid, where a stored point may drift off the circle the moment the radius changes.
Sniff: "arc" in geometry.
type RadialDimension
// = {
arc: ArcCurve;
angle: number;
}RadialDimensionEntity
type
type RadialDimensionEntity
// = EntityBase & DimensionEntityFields & { geometry: RadialDimension; }SectionEntity
type
type SectionEntity
// = EntityBase & { geometry: Section; }Text
type
A string placed and ORIENTED in space.
normal + xAxis make it self-determining in 3D: the plane it is written on and the reading direction inside that plane. yAxis is normal × xAxis, so it is derivable and therefore not stored — the same choice ArcCurve would make if it did not need both axes for its angle parameterisation.
Font, height and alignment are NOT here: they are STYLE, shared by every mark that draws text (see TextStyle), and a per-instance copy of them is what makes a drawing impossible to restyle.
Sniff: "text" in geometry && "point" in geometry.
type Text
// = {
text: string;
point: Point;
normal: Vector;
xAxis: Vector;
}TextEntity
type
A string on the drawing. style names a textStyles record (font, height, width factor, oblique) — the text itself carries none of that.
type TextEntity
// = EntityBase & { geometry: Text; style: string; }