StrokeCountMap Class
Data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.
For a simple primitive (line segment or arc) that is stroked with uniform fraction, the members are:
numStroke
= total number of strokescurveLength
= length of this curvea0
= external mapped coordinate for fraction 0 on this primitive or componenta1
= external mapped coordinate for fraction 1 on this primitive or component
For linestring and bspline curve, those numbers are totals for the overall curve, and breakdown within the components (line segments or bezier spans) is recorded on the optional array
componentData[]
- Members of the array are annotated with componentIndex within the linestring or bspline curve
Methods
Name | Description | |
---|---|---|
addToCountAndLength(numStroke: number, curveLength: number): void | Apply stroke count and curve length from a component to a parent map. | |
clone(): StrokeCountMap | Clone all data from root. | |
fractionToA(fraction: number): number | Interpolate in the a0,a1 mapping. | |
isCompatibleComponentStructure(other: StrokeCountMap, enforceCounts: boolean): boolean | Return true if other has the same component structure as this |
|
createWithComponentIndex(componentIndex: number0, numStroke: number0, curveLength: number0, a0: number0, a1: number0): StrokeCountMap Static | Create a StrokeCountMap with componentIndex (but no primitive or componentData array) |
|
createWithCurvePrimitive(primitive: CurvePrimitive, numStroke: number, curveLength: number, a0: number, a1: number, componentData?: StrokeCountMap[]): StrokeCountMap Static | Create a StrokeCountMap with curve primitive and optional componentData array. |
|
createWithCurvePrimitiveAndOptionalParent(curvePrimitive: CurvePrimitive, parentMap?: StrokeCountMap, componentData?: StrokeCountMap[]): StrokeCountMap Static | Create a StrokeCountMap, optionally |
Properties
Name | Type | Description | |
---|---|---|---|
a0 | number | Start coordinate (in user-defined space) for fraction 0 on this primitive or component | |
a1 | number | End coordinate (in user-defined space) for fraction 0 on this primitive or component | |
componentData | StrokeCountMap[] | undefined | Further StrokeCountMap's within this interval (e.g. | |
componentIndex | number | undefined | This curve's index within its parent. | |
curveLength | number | Length of the curve interval. | |
numStroke | number | Number of strokes expected in this interval. | |
primitive | CurvePrimitive | undefined | The curve that this map represents |
Defined in
- curve/Query/StrokeCountMap.ts Line 25
Last Updated: 17 December, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.