figureone 0.15.10 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/figureone.min.js +1 -1
- package/index.js +79167 -0
- package/package.json +15 -1
- package/types/index.d.ts +132 -0
- package/types/js/figure/Animation/Animation.d.ts +36 -0
- package/types/js/figure/Animation/AnimationBuilder.d.ts +173 -0
- package/types/js/figure/Animation/AnimationManager.d.ts +392 -0
- package/types/js/figure/Animation/AnimationStep/CustomStep.d.ts +99 -0
- package/types/js/figure/Animation/AnimationStep/DelayStep.d.ts +24 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ColorAnimationStep.d.ts +203 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/OpacityAnimationStep.d.ts +220 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PositionAnimationStep.d.ts +124 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseAnimationStep.d.ts +137 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseTransformAnimationStep.d.ts +52 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/RotationAnimationStep.d.ts +119 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScaleAnimationStep.d.ts +93 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScenarioAnimationStep.d.ts +204 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/TransformAnimationStep.d.ts +163 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep.d.ts +56 -0
- package/types/js/figure/Animation/AnimationStep/ParallelAnimationStep.d.ts +70 -0
- package/types/js/figure/Animation/AnimationStep/SerialAnimationStep.d.ts +84 -0
- package/types/js/figure/Animation/AnimationStep/TriggerStep.d.ts +106 -0
- package/types/js/figure/Animation/AnimationStep.d.ts +110 -0
- package/types/js/figure/DrawContext2D.d.ts +9 -0
- package/types/js/figure/DrawingObjects/DrawingObject.d.ts +45 -0
- package/types/js/figure/DrawingObjects/GLObject/GLObject.d.ts +146 -0
- package/types/js/figure/DrawingObjects/HTMLObject/HTMLObject.d.ts +29 -0
- package/types/js/figure/DrawingObjects/TextObject/TextObject.d.ts +94 -0
- package/types/js/figure/DrawingObjects/TextObject/glyphMeasures.d.ts +7 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexGeneric.d.ts +21 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexObject.d.ts +0 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexText.d.ts +34 -0
- package/types/js/figure/Element.d.ts +1212 -0
- package/types/js/figure/Equation/Elements/BaseAnnotationFunction.d.ts +118 -0
- package/types/js/figure/Equation/Elements/BaseEquationFunction.d.ts +20 -0
- package/types/js/figure/Equation/Elements/Bounds.d.ts +49 -0
- package/types/js/figure/Equation/Elements/Color.d.ts +7 -0
- package/types/js/figure/Equation/Elements/Container.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Element.d.ts +95 -0
- package/types/js/figure/Equation/Elements/Fraction.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Lines.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Matrix.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Offset.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Scale.d.ts +5 -0
- package/types/js/figure/Equation/Equation.d.ts +984 -0
- package/types/js/figure/Equation/EquationForm.d.ts +139 -0
- package/types/js/figure/Equation/EquationFunctions.d.ts +3367 -0
- package/types/js/figure/Equation/EquationSymbols.d.ts +1646 -0
- package/types/js/figure/Equation/HTMLEquation.d.ts +56 -0
- package/types/js/figure/Equation/Symbols/AngleBracket.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Arrow.d.ts +17 -0
- package/types/js/figure/Equation/Symbols/Bar.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Box.d.ts +11 -0
- package/types/js/figure/Equation/Symbols/Brace.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Bracket.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Division.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Integral.d.ts +7 -0
- package/types/js/figure/Equation/Symbols/Line.d.ts +5 -0
- package/types/js/figure/Equation/Symbols/Product.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Radical.d.ts +9 -0
- package/types/js/figure/Equation/Symbols/SquareBracket.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Strike.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Sum.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/SymbolNew.d.ts +15 -0
- package/types/js/figure/Equation/Symbols/Vinculum.d.ts +6 -0
- package/types/js/figure/Figure.d.ts +711 -0
- package/types/js/figure/FigureCollections/Angle.d.ts +766 -0
- package/types/js/figure/FigureCollections/Axis.d.ts +517 -0
- package/types/js/figure/FigureCollections/Axis3.d.ts +118 -0
- package/types/js/figure/FigureCollections/Button.d.ts +195 -0
- package/types/js/figure/FigureCollections/EquationLabel.d.ts +77 -0
- package/types/js/figure/FigureCollections/FigureCollections.d.ts +122 -0
- package/types/js/figure/FigureCollections/Legend.d.ts +270 -0
- package/types/js/figure/FigureCollections/Line.d.ts +587 -0
- package/types/js/figure/FigureCollections/Plot.d.ts +558 -0
- package/types/js/figure/FigureCollections/PolyLine.d.ts +487 -0
- package/types/js/figure/FigureCollections/Rectangle.d.ts +235 -0
- package/types/js/figure/FigureCollections/SlideNavigator.d.ts +255 -0
- package/types/js/figure/FigureCollections/Slider.d.ts +155 -0
- package/types/js/figure/FigureCollections/Text.d.ts +307 -0
- package/types/js/figure/FigureCollections/Toggle.d.ts +185 -0
- package/types/js/figure/FigureCollections/Trace.d.ts +237 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitive2DText.d.ts +119 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGLText.d.ts +94 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGesture.d.ts +536 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveMorph.d.ts +175 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes.d.ts +788 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes2D.d.ts +1324 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes3D.d.ts +1105 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitives.d.ts +173 -0
- package/types/js/figure/FigurePrimitives/Generic.d.ts +5 -0
- package/types/js/figure/FigurePrimitives/Text.d.ts +17 -0
- package/types/js/figure/FontManager.d.ts +113 -0
- package/types/js/figure/Gesture.d.ts +39 -0
- package/types/js/figure/Recorder/Recorder.d.ts +291 -0
- package/types/js/figure/Recorder/parseState.d.ts +3 -0
- package/types/js/figure/Recorder/recorder.worker.d.ts +1 -0
- package/types/js/figure/Recorder/state.d.ts +7 -0
- package/types/js/figure/SlideNavigator.d.ts +606 -0
- package/types/js/figure/TimeKeeper.d.ts +174 -0
- package/types/js/figure/geometries/arc.d.ts +18 -0
- package/types/js/figure/geometries/arrow.d.ts +215 -0
- package/types/js/figure/geometries/buffer.d.ts +4 -0
- package/types/js/figure/geometries/copy/copy.d.ts +178 -0
- package/types/js/figure/geometries/ellipse.d.ts +17 -0
- package/types/js/figure/geometries/line.d.ts +13 -0
- package/types/js/figure/geometries/lines/corners.d.ts +7 -0
- package/types/js/figure/geometries/lines/dashes.d.ts +23 -0
- package/types/js/figure/geometries/lines/lines.d.ts +31 -0
- package/types/js/figure/geometries/polygon/polygon.d.ts +12 -0
- package/types/js/figure/geometries/rectangle.d.ts +19 -0
- package/types/js/figure/geometries/triangle.d.ts +27 -0
- package/types/js/figure/webgl/Atlas.d.ts +42 -0
- package/types/js/figure/webgl/shaders.d.ts +143 -0
- package/types/js/figure/webgl/target.d.ts +9 -0
- package/types/js/figure/webgl/webgl.d.ts +54 -0
- package/types/js/tools/FunctionMap.d.ts +69 -0
- package/types/js/tools/color.d.ts +11 -0
- package/types/js/tools/colorNames.d.ts +2 -0
- package/types/js/tools/d2/polygon.d.ts +60 -0
- package/types/js/tools/d2/triangles.d.ts +0 -0
- package/types/js/tools/d3/cone.d.ts +57 -0
- package/types/js/tools/d3/cube.d.ts +26 -0
- package/types/js/tools/d3/cylinder.d.ts +45 -0
- package/types/js/tools/d3/line3.d.ts +55 -0
- package/types/js/tools/d3/prism.d.ts +49 -0
- package/types/js/tools/d3/revolve.d.ts +87 -0
- package/types/js/tools/d3/sphere.d.ts +33 -0
- package/types/js/tools/d3/surface.d.ts +47 -0
- package/types/js/tools/g2.d.ts +242 -0
- package/types/js/tools/geometry/Bounds.d.ts +446 -0
- package/types/js/tools/geometry/Line.d.ts +314 -0
- package/types/js/tools/geometry/Path.d.ts +67 -0
- package/types/js/tools/geometry/Plane.d.ts +201 -0
- package/types/js/tools/geometry/Point.d.ts +359 -0
- package/types/js/tools/geometry/Rect.d.ts +115 -0
- package/types/js/tools/geometry/Transform.d.ts +623 -0
- package/types/js/tools/geometry/angle.d.ts +105 -0
- package/types/js/tools/geometry/common.d.ts +9 -0
- package/types/js/tools/geometry/coordinates.d.ts +30 -0
- package/types/js/tools/geometry/deceleration.d.ts +13 -0
- package/types/js/tools/geometry/polygon.d.ts +4 -0
- package/types/js/tools/geometry/quaternion.d.ts +15 -0
- package/types/js/tools/geometry/scene.d.ts +282 -0
- package/types/js/tools/geometry/tools.d.ts +8 -0
- package/types/js/tools/geometry/types.d.ts +2 -0
- package/types/js/tools/getCssColors.d.ts +1 -0
- package/types/js/tools/getCssVariables.d.ts +4 -0
- package/types/js/tools/getImageData.d.ts +1 -0
- package/types/js/tools/getScssColors.d.ts +2 -0
- package/types/js/tools/htmlGenerator.d.ts +85 -0
- package/types/js/tools/m2.d.ts +24 -0
- package/types/js/tools/m3.d.ts +71 -0
- package/types/js/tools/math.d.ts +112 -0
- package/types/js/tools/morph.d.ts +651 -0
- package/types/js/tools/styleSheets.d.ts +3 -0
- package/types/js/tools/tools.d.ts +281 -0
- package/types/js/tools/types.d.ts +305 -0
- package/figureone.worker.js +0 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { Point } from './Point';
|
|
2
|
+
import { Plane } from './Plane';
|
|
3
|
+
import { Line } from './Line';
|
|
4
|
+
import type { TypeParsablePoint } from './Point';
|
|
5
|
+
import type { OBJ_LineDefinition, TypeParsableLine } from './Line';
|
|
6
|
+
/**
|
|
7
|
+
* Bounds intersect result
|
|
8
|
+
*
|
|
9
|
+
* @property {number | Point | null} [intersect] `null` means there is no
|
|
10
|
+
* intersect
|
|
11
|
+
* @property {number | Point} [reflection]
|
|
12
|
+
* @property {number} [distance] distance from value or Point and boundary in
|
|
13
|
+
* direction specified
|
|
14
|
+
* @group Misc Shapes
|
|
15
|
+
*/
|
|
16
|
+
export type BoundsIntersect = {
|
|
17
|
+
intersect: number | Point | null;
|
|
18
|
+
reflection: number | Point;
|
|
19
|
+
distance: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Point Bounds intersect result
|
|
23
|
+
*
|
|
24
|
+
* @property {Point | null} [intersect]
|
|
25
|
+
* @property {Point} [reflection]
|
|
26
|
+
* @property {number} [distance]
|
|
27
|
+
* @group Misc Shapes
|
|
28
|
+
*/
|
|
29
|
+
export type BoundsPointIntersect = {
|
|
30
|
+
intersect: Point | null;
|
|
31
|
+
reflection: Point;
|
|
32
|
+
distance: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Bounds value intersect result
|
|
36
|
+
*
|
|
37
|
+
* @property {number | null} [intersect]
|
|
38
|
+
* @property {number} [reflection]
|
|
39
|
+
* @property {number} [distance]
|
|
40
|
+
* @group Misc Shapes
|
|
41
|
+
*/
|
|
42
|
+
export type BoundsValueIntersect = {
|
|
43
|
+
intersect: number | null;
|
|
44
|
+
reflection: number;
|
|
45
|
+
distance: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Base class for all bounds.
|
|
49
|
+
*
|
|
50
|
+
* Either a value or a {@link Point} can be bounded.
|
|
51
|
+
*
|
|
52
|
+
* A Bounds must be able to:
|
|
53
|
+
* - store a boundary
|
|
54
|
+
* - check if a value or point is contained within the boundary
|
|
55
|
+
* - clip a value or point to within the boundary
|
|
56
|
+
* - find the intersect between the boundary and a value or point in some
|
|
57
|
+
* direction
|
|
58
|
+
* @group Misc Shapes
|
|
59
|
+
*/
|
|
60
|
+
declare class Bounds {
|
|
61
|
+
boundary: any;
|
|
62
|
+
precision: number;
|
|
63
|
+
/**
|
|
64
|
+
* @param {Object} boundary
|
|
65
|
+
* @param {number} precision default precision for calculations
|
|
66
|
+
*/
|
|
67
|
+
constructor(boundary?: any, precision?: number);
|
|
68
|
+
/**
|
|
69
|
+
* Duplicate the bounds object
|
|
70
|
+
*/
|
|
71
|
+
_dup(): Bounds;
|
|
72
|
+
_state(options: {
|
|
73
|
+
precision: number;
|
|
74
|
+
}): {
|
|
75
|
+
f1Type: string;
|
|
76
|
+
state: any[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Returns `true` if a value or {@link Point} is within the bounds.
|
|
80
|
+
* @param {number | TypeParsablePoint} valueOrPosition
|
|
81
|
+
* @param {boolean} [projectToPlane] optional flag used by some bounds types
|
|
82
|
+
* @return {boolean}
|
|
83
|
+
*/
|
|
84
|
+
contains(valueOrPosition: number | TypeParsablePoint, projectToPlane?: boolean): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Returns `true` if a value or {@link Point} is within the bounds.
|
|
87
|
+
* @param {number | TypeParsablePoint} valueOrPosition
|
|
88
|
+
* @return {BoundsIntersect}
|
|
89
|
+
*/
|
|
90
|
+
intersect(valueOrPosition: number | TypeParsablePoint, direction?: number | TypeParsablePoint): BoundsIntersect;
|
|
91
|
+
/**
|
|
92
|
+
* Clips a value or {@link Point} to be within a boundary.
|
|
93
|
+
* @param {number | TypeParsablePoint} valueOrPosition
|
|
94
|
+
* @return {number | Point}
|
|
95
|
+
*/
|
|
96
|
+
clip(valueOrPosition: number | TypeParsablePoint): number | Point;
|
|
97
|
+
isDefined(): boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Range bounds object definition.
|
|
101
|
+
*
|
|
102
|
+
* A range bounds defines a minimum and maximum value.
|
|
103
|
+
*
|
|
104
|
+
* @property {number | null} [min] minimum value boundary, null for unbounded
|
|
105
|
+
* (`null`)
|
|
106
|
+
* @property {number | null} [max] maximum value boundary, null for unbounded
|
|
107
|
+
* (`null`)
|
|
108
|
+
* @property {number} [precision] precision with which to calculate boundary
|
|
109
|
+
* `intersect` and `contains` (`8`)
|
|
110
|
+
* @interface
|
|
111
|
+
* @group Interactivity
|
|
112
|
+
*/
|
|
113
|
+
export type OBJ_RangeBounds = {
|
|
114
|
+
min?: number | null;
|
|
115
|
+
max?: number | null;
|
|
116
|
+
precision?: number;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Recorder state definition of a {@link RangeBounds} that represents the
|
|
120
|
+
* precision, min, and max bounds.
|
|
121
|
+
*
|
|
122
|
+
* ```
|
|
123
|
+
* {
|
|
124
|
+
* f1Type: 'rangeBounds',
|
|
125
|
+
* state: [
|
|
126
|
+
* number, number | null, number | null,
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
* @group Misc Shapes
|
|
130
|
+
*/
|
|
131
|
+
type TypeF1DefRangeBounds = {
|
|
132
|
+
f1Type: 'rangeBounds';
|
|
133
|
+
state: [number, number | null, number | null];
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* A RangeBounds defines a bounds for a value or {@link Point} between some
|
|
137
|
+
* minimum and maximum value.
|
|
138
|
+
*
|
|
139
|
+
* When using points, the minimum and maximum value is applied to each component
|
|
140
|
+
* of the point separately.
|
|
141
|
+
* @group Misc Shapes
|
|
142
|
+
*/
|
|
143
|
+
declare class RangeBounds extends Bounds {
|
|
144
|
+
boundary: {
|
|
145
|
+
min: number | null;
|
|
146
|
+
max: number | null;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* @param {OBJ_RangeBounds} boundary
|
|
150
|
+
*/
|
|
151
|
+
constructor(boundary: OBJ_RangeBounds);
|
|
152
|
+
isDefined(): boolean;
|
|
153
|
+
_dup(): RangeBounds;
|
|
154
|
+
_state(options: {
|
|
155
|
+
precision: number;
|
|
156
|
+
}): {
|
|
157
|
+
f1Type: string;
|
|
158
|
+
state: [number, number | null, number | null];
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Returns `true` if a value or each x, y and z component of a {@link Point}
|
|
162
|
+
* is within the max and min bounds (on bounds is considered within).
|
|
163
|
+
*
|
|
164
|
+
* @param {number | TypeParsablePoint} valueOrPosition
|
|
165
|
+
* @return {boolean}
|
|
166
|
+
*/
|
|
167
|
+
contains(position: number | TypeParsablePoint): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Returns the max or min bound that is met by a value moving in the positive
|
|
170
|
+
* or negative direction.
|
|
171
|
+
*
|
|
172
|
+
* The return object includes the intersect boundary, the distance to the
|
|
173
|
+
* boundary and the reflected direction.
|
|
174
|
+
*
|
|
175
|
+
* If the value lies outside the bounds, it will first be clipped to the
|
|
176
|
+
* bounds.
|
|
177
|
+
*
|
|
178
|
+
* @param {number} value
|
|
179
|
+
* @return {BoundsIntersect}
|
|
180
|
+
*/
|
|
181
|
+
intersect(value: number, direction?: number): BoundsValueIntersect;
|
|
182
|
+
/**
|
|
183
|
+
* Clip a value or {@link Point} to within a range of bounds.
|
|
184
|
+
*
|
|
185
|
+
* If {@link Point}, then each x, y, and z component of the point will be
|
|
186
|
+
* independently clipped.
|
|
187
|
+
*
|
|
188
|
+
* @param {number | TypeParsablePoint} valueOrPosition
|
|
189
|
+
* @return {number | Point}
|
|
190
|
+
*/
|
|
191
|
+
clip(value: number): number;
|
|
192
|
+
clip(position: TypeParsablePoint): Point;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Recorder state definition of a {@link RectBounds} that represents the
|
|
196
|
+
* precision, left, right, bottom, top, plane position, top direction and
|
|
197
|
+
* right direction of the rectangle
|
|
198
|
+
*
|
|
199
|
+
* ```
|
|
200
|
+
* {
|
|
201
|
+
* f1Type: 'rectBounds',
|
|
202
|
+
* state: [
|
|
203
|
+
* number, number, number, number, number,
|
|
204
|
+
* [number, number, number],
|
|
205
|
+
* [number, number, number],
|
|
206
|
+
* [number, number, number],
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
* @group Misc Shapes
|
|
210
|
+
*/
|
|
211
|
+
export type TypeF1DefRectBounds = {
|
|
212
|
+
f1Type: 'rectBounds';
|
|
213
|
+
state: [
|
|
214
|
+
number,
|
|
215
|
+
number,
|
|
216
|
+
number,
|
|
217
|
+
number,
|
|
218
|
+
number,
|
|
219
|
+
[
|
|
220
|
+
number,
|
|
221
|
+
number,
|
|
222
|
+
number
|
|
223
|
+
],
|
|
224
|
+
[number, number, number],
|
|
225
|
+
[number, number, number]
|
|
226
|
+
];
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* A RectBounds is a rectangle bounds around a point in a plane.
|
|
230
|
+
|
|
231
|
+
* It is defined by:
|
|
232
|
+
* - a position in plane around which rectangle is formed
|
|
233
|
+
* - topDirection/rightDirection vectors that orient the rectangle
|
|
234
|
+
* - left/right magnitudes that define the width of the rectangle
|
|
235
|
+
* - bottom/top magnitudes that define the height of the rectangle
|
|
236
|
+
*
|
|
237
|
+
* ```
|
|
238
|
+
---------------------------------------------- A
|
|
239
|
+
| | |
|
|
240
|
+
| Top Vector | |
|
|
241
|
+
| A | | top
|
|
242
|
+
| | | |
|
|
243
|
+
| | | |
|
|
244
|
+
| position *-----> | ---
|
|
245
|
+
| Right Vector | |
|
|
246
|
+
| | | bottom
|
|
247
|
+
| | |
|
|
248
|
+
---------------------------------------------- V
|
|
249
|
+
. |
|
|
250
|
+
. |
|
|
251
|
+
<-------------|----------------------------->
|
|
252
|
+
left right
|
|
253
|
+
```
|
|
254
|
+
* A rectangle can be defined in one of several ways:
|
|
255
|
+
* - position, plane normal, one direction vecvtor (top or right)
|
|
256
|
+
* - position, top and right direction vectors
|
|
257
|
+
*
|
|
258
|
+
* By default the rectangle will be in the XY plane (+z normal) with a
|
|
259
|
+
* rightDirection vector along the +x axis.
|
|
260
|
+
*
|
|
261
|
+
* @property {TypeParsablePoint} [position]
|
|
262
|
+
* @property {TypeParsablePoint} [normal]
|
|
263
|
+
* @property {TypeParsablePoint} [rightDirection]
|
|
264
|
+
* @property {TypeParsablePoint} [topDirection]
|
|
265
|
+
* @property {number} [left]
|
|
266
|
+
* @property {number} [right]
|
|
267
|
+
* @property {number} [top]
|
|
268
|
+
* @property {number} [bottom]
|
|
269
|
+
* @property {number} [precision] precision with which to calculate boundary
|
|
270
|
+
* `intersect` and `contains` (`8`)
|
|
271
|
+
* @interface
|
|
272
|
+
* @group Interactivity
|
|
273
|
+
*/
|
|
274
|
+
export type OBJ_RectBounds = {
|
|
275
|
+
position?: TypeParsablePoint;
|
|
276
|
+
normal?: TypeParsablePoint;
|
|
277
|
+
rightDirection?: TypeParsablePoint;
|
|
278
|
+
topDirection?: TypeParsablePoint;
|
|
279
|
+
left?: number;
|
|
280
|
+
right?: number;
|
|
281
|
+
bottom?: number;
|
|
282
|
+
top?: number;
|
|
283
|
+
precision?: number;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* A RectBounds defines a rectangular bounds for a {@link Point}.
|
|
287
|
+
* @group Misc Shapes
|
|
288
|
+
*/
|
|
289
|
+
declare class RectBounds extends Bounds {
|
|
290
|
+
plane: Plane;
|
|
291
|
+
rightDirection: Point;
|
|
292
|
+
topDirection: Point;
|
|
293
|
+
left: number;
|
|
294
|
+
right: number;
|
|
295
|
+
bottom: number;
|
|
296
|
+
top: number;
|
|
297
|
+
boundary: {
|
|
298
|
+
left: Line;
|
|
299
|
+
right: Line;
|
|
300
|
+
bottom: Line;
|
|
301
|
+
top: Line;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* @param {OBJ_RectBounds} boundary
|
|
305
|
+
*/
|
|
306
|
+
constructor(boundary: OBJ_RectBounds);
|
|
307
|
+
isDefined(): boolean;
|
|
308
|
+
_dup(): RectBounds;
|
|
309
|
+
/**
|
|
310
|
+
* Return a bounds copy with all values rounded to a precision.
|
|
311
|
+
*
|
|
312
|
+
* @param {number} precision
|
|
313
|
+
* @return {RectBounds}
|
|
314
|
+
*/
|
|
315
|
+
round(precision?: number): RectBounds;
|
|
316
|
+
_state(options: {
|
|
317
|
+
precision: number;
|
|
318
|
+
}): TypeF1DefRectBounds;
|
|
319
|
+
/**
|
|
320
|
+
* Return `true` if `position` is within the rectangular bounds.
|
|
321
|
+
*
|
|
322
|
+
* If `projectToPlane` is `false`, then position must be on plane, otherwise
|
|
323
|
+
* if `true` then point will be projected to the plane before checking if it
|
|
324
|
+
* within the rectangle.
|
|
325
|
+
*
|
|
326
|
+
* @param {TypeParsablePoint} position
|
|
327
|
+
* @param {boolean} projectToPlane
|
|
328
|
+
* @return {boolean}
|
|
329
|
+
*/
|
|
330
|
+
contains(position: TypeParsablePoint, projectToPlane?: boolean): boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Clip a position to the bounds rectangle. If the position is off plane, then
|
|
333
|
+
* it will first be projected to the plane.
|
|
334
|
+
*
|
|
335
|
+
*
|
|
336
|
+
* @param {TypeParsablePoint} position
|
|
337
|
+
* @return {Point}
|
|
338
|
+
*/
|
|
339
|
+
clip(position: TypeParsablePoint): Point;
|
|
340
|
+
getBoundIntersect(position: Point, direction: Point, posBound: Line, negBound: Line, posDirection: Point): {
|
|
341
|
+
intersect: Point;
|
|
342
|
+
distance: number;
|
|
343
|
+
normal: Point;
|
|
344
|
+
} | null;
|
|
345
|
+
/**
|
|
346
|
+
* Return the intersect between a `position` moving in some `direction` and
|
|
347
|
+
* the four boundaries of the rectangle.
|
|
348
|
+
*
|
|
349
|
+
* @param {TypeParsablePoint} position
|
|
350
|
+
* @param {TypeParsablePoint} direction direction vector
|
|
351
|
+
* @return {BoundsIntersect}
|
|
352
|
+
*/
|
|
353
|
+
intersect(position: TypeParsablePoint, direction: TypeParsablePoint): BoundsPointIntersect;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* A line bounds defines a line boundary.
|
|
357
|
+
*
|
|
358
|
+
* @property {TypeParsableLine} [line]
|
|
359
|
+
* @property {number} [precision] precision with which to calculate boundary
|
|
360
|
+
* `intersect` and `contains` (`8`)
|
|
361
|
+
* @interface
|
|
362
|
+
* @group Interactivity
|
|
363
|
+
*/
|
|
364
|
+
export type OBJ_LineBounds = OBJ_LineDefinition & {
|
|
365
|
+
precision?: number;
|
|
366
|
+
line?: TypeParsableLine;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Recorder state definition of a {@link LineBounds} that represents the
|
|
370
|
+
* precision, first point, second point and number of ends.
|
|
371
|
+
*
|
|
372
|
+
* ```
|
|
373
|
+
* {
|
|
374
|
+
* f1Type: 'lineBounds',
|
|
375
|
+
* state: [
|
|
376
|
+
* number,
|
|
377
|
+
* [number, number, number],
|
|
378
|
+
* [number, number, number],
|
|
379
|
+
* 2 | 1 | 0,
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
* @group Misc Shapes
|
|
383
|
+
*/
|
|
384
|
+
export type TypeF1DefLineBounds = {
|
|
385
|
+
f1Type: 'lineBounds';
|
|
386
|
+
state: [number, [number, number, number], [number, number, number], 2 | 1 | 0];
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* A Line defines a line bounds for a {@link Point}.
|
|
390
|
+
* @group Misc Shapes
|
|
391
|
+
*/
|
|
392
|
+
declare class LineBounds extends Bounds {
|
|
393
|
+
boundary: Line;
|
|
394
|
+
isDefined(): boolean;
|
|
395
|
+
_dup(): LineBounds;
|
|
396
|
+
/**
|
|
397
|
+
* @param {OBJ_LineBounds} boundary
|
|
398
|
+
*/
|
|
399
|
+
constructor(boundary: OBJ_LineBounds);
|
|
400
|
+
_state(options: {
|
|
401
|
+
precision: number;
|
|
402
|
+
}): TypeF1DefLineBounds;
|
|
403
|
+
/**
|
|
404
|
+
* Check if a position is within a line
|
|
405
|
+
*
|
|
406
|
+
* @param {TypeParsablePoint} position
|
|
407
|
+
* @return {boolean}
|
|
408
|
+
*/
|
|
409
|
+
contains(position: TypeParsablePoint): boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Clip a position to a line. The point will be projected to the line before
|
|
412
|
+
* clipping.
|
|
413
|
+
*
|
|
414
|
+
* @param {TypeParsablePoint} position
|
|
415
|
+
* @return {Point}
|
|
416
|
+
*/
|
|
417
|
+
clip(position: number | TypeParsablePoint): Point;
|
|
418
|
+
/**
|
|
419
|
+
* Return the intersect between a `position` moving in some `direction` and
|
|
420
|
+
* the ends of the line boundary.
|
|
421
|
+
*
|
|
422
|
+
* The position and direction vector will first be projected onto the line
|
|
423
|
+
* before finding the intersect.
|
|
424
|
+
*
|
|
425
|
+
* @param {TypeParsablePoint} position
|
|
426
|
+
* @param {TypeParsablePoint} direction direction vector
|
|
427
|
+
* @return {BoundsIntersect}
|
|
428
|
+
*/
|
|
429
|
+
intersect(position: TypeParsablePoint, direction: TypeParsablePoint): BoundsPointIntersect;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Parsable bounds definition.
|
|
433
|
+
*
|
|
434
|
+
* `null | `{@link Bounds}
|
|
435
|
+
| {@link RectBounds}` | `{@link LineBounds}` | `{@link RangeBounds}
|
|
436
|
+
` | `{@link OBJ_RectBounds}` | `{@link OBJ_LineBounds}` | `{@link OBJ_RangeBounds}
|
|
437
|
+
` | `{@link TypeF1DefRangeBounds}` | `{@link TypeF1DefRectBounds}` | `{@link TypeF1DefLineBounds}
|
|
438
|
+
* @group Interactivity
|
|
439
|
+
*/
|
|
440
|
+
export type TypeParsableBounds = null | Bounds | RectBounds | LineBounds | RangeBounds | OBJ_RectBounds | OBJ_LineBounds | OBJ_RangeBounds | TypeF1DefRangeBounds | TypeF1DefRectBounds | TypeF1DefLineBounds;
|
|
441
|
+
/**
|
|
442
|
+
* Get bounds from a parsable bounds.
|
|
443
|
+
* @group Misc Shapes
|
|
444
|
+
*/
|
|
445
|
+
declare function getBounds(bounds: TypeParsableBounds): Bounds | RectBounds | LineBounds | RangeBounds;
|
|
446
|
+
export { RangeBounds, Bounds, LineBounds, RectBounds, getBounds, };
|