@types/three 0.150.2 → 0.152.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.
- three/README.md +2 -2
- three/build/three.min.d.ts +2 -0
- three/build/three.module.min.d.ts +2 -0
- three/examples/jsm/controls/MapControls.d.ts +21 -0
- three/examples/jsm/controls/OrbitControls.d.ts +1 -5
- three/examples/jsm/controls/PointerLockControls.d.ts +3 -0
- three/examples/jsm/controls/TrackballControls.d.ts +2 -0
- three/examples/jsm/helpers/ViewHelper.d.ts +3 -4
- three/examples/jsm/libs/tween.module.d.ts +2 -0
- three/examples/jsm/loaders/GLTFLoader.d.ts +2 -4
- three/examples/jsm/loaders/SVGLoader.d.ts +15 -3
- three/examples/jsm/nodes/Nodes.d.ts +131 -226
- three/examples/jsm/nodes/{core → code}/CodeNode.d.ts +2 -3
- three/examples/jsm/nodes/{core → code}/ExpressionNode.d.ts +2 -2
- three/examples/jsm/nodes/{core → code}/FunctionCallNode.d.ts +2 -2
- three/examples/jsm/nodes/{core → code}/FunctionNode.d.ts +4 -4
- three/examples/jsm/nodes/core/InputNode.d.ts +4 -0
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +1 -11
- three/examples/jsm/nodes/core/NodeUtils.d.ts +8 -2
- three/examples/jsm/nodes/core/{VaryNode.d.ts → VaryingNode.d.ts} +1 -1
- three/examples/jsm/nodes/core/constants.d.ts +1 -0
- three/examples/jsm/nodes/fog/FogNode.d.ts +1 -1
- three/examples/jsm/nodes/geometry/RangeNode.d.ts +2 -1
- three/examples/jsm/nodes/lighting/LightUtils.d.ts +4 -0
- three/examples/jsm/nodes/lighting/PointLightNode.d.ts +10 -0
- three/examples/jsm/nodes/lighting/SpotLightNode.d.ts +15 -0
- three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +0 -7
- three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +0 -9
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -9
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +17 -1
- three/examples/jsm/nodes/math/MathNode.d.ts +2 -2
- three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +2 -2
- three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -2
- three/examples/jsm/objects/{GroundProjectedEnv.d.ts → GroundProjectedSkybox.d.ts} +1 -1
- three/examples/jsm/postprocessing/Pass.d.ts +2 -0
- three/examples/jsm/renderers/CSS2DRenderer.d.ts +2 -1
- three/examples/jsm/renderers/CSS3DRenderer.d.ts +2 -2
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +1 -21
- three/examples/jsm/utils/BufferGeometryUtils.d.ts +12 -2
- three/examples/jsm/utils/SkeletonUtils.d.ts +3 -19
- three/index.d.ts +1 -1
- three/package.json +3 -2
- three/src/Three.d.ts +1 -0
- three/src/constants.d.ts +3 -23
- three/src/core/BufferGeometry.d.ts +60 -33
- three/src/core/Raycaster.d.ts +2 -1
- three/src/extras/DataUtils.d.ts +13 -0
- three/src/extras/Earcut.d.ts +12 -0
- three/src/extras/ImageUtils.d.ts +20 -20
- three/src/extras/PMREMGenerator.d.ts +66 -0
- three/src/extras/ShapeUtils.d.ts +19 -1
- three/src/extras/core/Curve.d.ts +86 -31
- three/src/extras/core/CurvePath.d.ts +46 -4
- three/src/extras/core/Interpolations.d.ts +36 -0
- three/src/extras/core/Path.d.ts +122 -15
- three/src/extras/core/Shape.d.ts +56 -6
- three/src/extras/core/ShapePath.d.ts +73 -8
- three/src/extras/curves/ArcCurve.d.ts +35 -3
- three/src/extras/curves/CatmullRomCurve3.d.ts +62 -15
- three/src/extras/curves/CubicBezierCurve.d.ts +48 -7
- three/src/extras/curves/CubicBezierCurve3.d.ts +48 -7
- three/src/extras/curves/EllipseCurve.d.ts +73 -18
- three/src/extras/curves/LineCurve.d.ts +26 -5
- three/src/extras/curves/LineCurve3.d.ts +26 -5
- three/src/extras/curves/QuadraticBezierCurve.d.ts +44 -6
- three/src/extras/curves/QuadraticBezierCurve3.d.ts +44 -6
- three/src/extras/curves/SplineCurve.d.ts +39 -3
- three/src/helpers/ArrowHelper.d.ts +47 -16
- three/src/helpers/AxesHelper.d.ts +35 -3
- three/src/helpers/Box3Helper.d.ts +28 -4
- three/src/helpers/BoxHelper.d.ts +44 -4
- three/src/helpers/CameraHelper.d.ts +38 -19
- three/src/helpers/DirectionalLightHelper.d.ts +57 -10
- three/src/helpers/GridHelper.d.ts +32 -6
- three/src/helpers/HemisphereLightHelper.d.ts +56 -3
- three/src/helpers/PlaneHelper.d.ts +31 -8
- three/src/helpers/PointLightHelper.d.ts +54 -6
- three/src/helpers/PolarGridHelper.d.ts +35 -8
- three/src/helpers/SkeletonHelper.d.ts +56 -8
- three/src/helpers/SpotLightHelper.d.ts +59 -4
- three/src/lights/AmbientLight.d.ts +23 -10
- three/src/lights/AmbientLightProbe.d.ts +18 -0
- three/src/lights/DirectionalLight.d.ts +75 -20
- three/src/lights/DirectionalLightShadow.d.ts +68 -2
- three/src/lights/HemisphereLight.d.ts +45 -12
- three/src/lights/HemisphereLightProbe.d.ts +19 -0
- three/src/lights/Light.d.ts +40 -43
- three/src/lights/LightProbe.d.ts +32 -5
- three/src/lights/LightShadow.d.ts +100 -18
- three/src/lights/PointLight.d.ts +57 -12
- three/src/lights/PointLightShadow.d.ts +18 -2
- three/src/lights/RectAreaLight.d.ts +60 -8
- three/src/lights/SpotLight.d.ts +105 -20
- three/src/lights/SpotLightShadow.d.ts +63 -3
- three/src/materials/LineBasicMaterial.d.ts +7 -1
- three/src/materials/MeshDistanceMaterial.d.ts +0 -15
- three/src/materials/ShaderMaterial.d.ts +1 -1
- three/src/math/Color.d.ts +23 -2
- three/src/math/Quaternion.d.ts +6 -0
- three/src/math/Triangle.d.ts +40 -0
- three/src/math/Vector2.d.ts +5 -0
- three/src/math/Vector3.d.ts +10 -3
- three/src/objects/InstancedMesh.d.ts +22 -30
- three/src/objects/LineSegments.d.ts +2 -0
- three/src/objects/Points.d.ts +7 -6
- three/src/objects/Skeleton.d.ts +5 -1
- three/src/objects/SkinnedMesh.d.ts +37 -25
- three/src/renderers/WebGLRenderTarget.d.ts +3 -0
- three/src/renderers/WebGLRenderer.d.ts +25 -1
- three/src/renderers/shaders/ShaderChunk.d.ts +58 -37
- three/src/renderers/shaders/UniformsLib.d.ts +88 -57
- three/src/textures/CanvasTexture.d.ts +0 -1
- three/src/textures/CompressedTexture.d.ts +3 -2
- three/src/textures/CubeTexture.d.ts +3 -4
- three/src/textures/DataTexture.d.ts +3 -3
- three/src/textures/Texture.d.ts +37 -24
- three/examples/jsm/nodes/functions/light/getDistanceAttenuation.d.ts +0 -5
- three/examples/jsm/nodes/lighting/PunctualLightNode.d.ts +0 -12
three/src/extras/core/Shape.d.ts
CHANGED
|
@@ -2,27 +2,77 @@ import { Vector2 } from './../../math/Vector2';
|
|
|
2
2
|
import { Path } from './Path';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Defines
|
|
5
|
+
* Defines an arbitrary 2d {@link Shape} plane using paths with optional holes
|
|
6
|
+
* @remarks
|
|
7
|
+
* It can be used with {@link THREE.ExtrudeGeometry | ExtrudeGeometry}, {@link THREE.ShapeGeometry | ShapeGeometry}, to get points, or to get triangulated faces.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const heartShape = new THREE.Shape();
|
|
11
|
+
* heartShape.moveTo(25, 25);
|
|
12
|
+
* heartShape.bezierCurveTo(25, 25, 20, 0, 0, 0);
|
|
13
|
+
* heartShape.bezierCurveTo(-30, 0, -30, 35, -30, 35);
|
|
14
|
+
* heartShape.bezierCurveTo(-30, 55, -10, 77, 25, 95);
|
|
15
|
+
* heartShape.bezierCurveTo(60, 77, 80, 55, 80, 35);
|
|
16
|
+
* heartShape.bezierCurveTo(80, 35, 80, 0, 50, 0);
|
|
17
|
+
* heartShape.bezierCurveTo(35, 0, 25, 25, 25, 25);
|
|
18
|
+
* const extrudeSettings = {
|
|
19
|
+
* depth: 8,
|
|
20
|
+
* bevelEnabled: true,
|
|
21
|
+
* bevelSegments: 2,
|
|
22
|
+
* steps: 2,
|
|
23
|
+
* bevelSize: 1,
|
|
24
|
+
* bevelThickness: 1
|
|
25
|
+
* };
|
|
26
|
+
* const geometry = new THREE.ExtrudeGeometry(heartShape, extrudeSettings);
|
|
27
|
+
* const mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial());
|
|
28
|
+
* ```
|
|
29
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_shapes | geometry / shapes }
|
|
30
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_extrude_shapes | geometry / extrude / shapes }
|
|
31
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_extrude_shapes2 | geometry / extrude / shapes2 }
|
|
32
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/core/Shape | Official Documentation}
|
|
33
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/Shape.js | Source}
|
|
6
34
|
*/
|
|
7
35
|
export class Shape extends Path {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a {@link Shape} from the points
|
|
38
|
+
* @remarks
|
|
39
|
+
* The first point defines the offset, then successive points are added to the {@link CurvePath.curves | curves} array as {@link THREE.LineCurve | LineCurves}.
|
|
40
|
+
* If no points are specified, an empty {@link Shape} is created and the {@link .currentPoint} is set to the origin.
|
|
41
|
+
* @param points Array of {@link Vector2 | Vector2s}.
|
|
42
|
+
*/
|
|
8
43
|
constructor(points?: Vector2[]);
|
|
9
44
|
|
|
10
45
|
/**
|
|
11
|
-
*
|
|
46
|
+
* A Read-only _string_ to check if `this` object type.
|
|
47
|
+
* @remarks Sub-classes will update this value.
|
|
48
|
+
* @defaultValue `Shape`
|
|
12
49
|
*/
|
|
13
|
-
type: string;
|
|
50
|
+
override readonly type: string | 'Shape';
|
|
14
51
|
|
|
52
|
+
/**
|
|
53
|
+
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
|
|
54
|
+
* @remarks This gets automatically assigned and shouldn't be edited.
|
|
55
|
+
*/
|
|
15
56
|
uuid: string;
|
|
16
57
|
|
|
17
58
|
/**
|
|
18
|
-
* @
|
|
59
|
+
* An array of {@link Path | paths} that define the holes in the shape.
|
|
60
|
+
* @defaultValue `[]`
|
|
19
61
|
*/
|
|
20
62
|
holes: Path[];
|
|
21
63
|
|
|
22
|
-
|
|
23
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Call {@link THREE.Curve.getPoints | getPoints} on the {@link Shape} and the {@link holes} array
|
|
66
|
+
* @param divisions The fineness of the result. Expects a `Integer`
|
|
67
|
+
*/
|
|
24
68
|
extractPoints(divisions: number): {
|
|
25
69
|
shape: Vector2[];
|
|
26
70
|
holes: Vector2[][];
|
|
27
71
|
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get an array of {@link Vector2 | Vector2's} that represent the holes in the shape.
|
|
75
|
+
* @param divisions The fineness of the result. Expects a `Integer`
|
|
76
|
+
*/
|
|
77
|
+
getPointsHoles(divisions: number): Vector2[][];
|
|
28
78
|
}
|
|
@@ -1,34 +1,99 @@
|
|
|
1
1
|
import { Vector2 } from './../../math/Vector2';
|
|
2
2
|
import { Shape } from './Shape';
|
|
3
3
|
import { Color } from '../../math/Color';
|
|
4
|
+
import { Path } from './Path';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* This class is used to convert a series of shapes to an array of {@link THREE.Path | Path's},
|
|
8
|
+
* for example an SVG shape to a path (see the example below).
|
|
9
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_extrude_shapes2 | geometry / extrude / shapes2}
|
|
10
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/core/ShapePath | Official Documentation}
|
|
11
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/ShapePath.js | Source}
|
|
12
|
+
*/
|
|
5
13
|
export class ShapePath {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new {@link ShapePath}
|
|
16
|
+
* @remarks
|
|
17
|
+
* Unlike a {@link THREE.Path | Path}, no points are passed in as the {@link ShapePath} is designed to be generated after creation.
|
|
18
|
+
*/
|
|
6
19
|
constructor();
|
|
7
20
|
|
|
8
21
|
/**
|
|
9
|
-
*
|
|
22
|
+
* A Read-only _string_ to check if `this` object type.
|
|
23
|
+
* @remarks Sub-classes will update this value.
|
|
24
|
+
* @defaultValue `ShapePath`
|
|
10
25
|
*/
|
|
11
|
-
type:
|
|
26
|
+
readonly type: 'ShapePath';
|
|
12
27
|
|
|
13
28
|
/**
|
|
14
|
-
* @
|
|
29
|
+
* Array of {@link THREE.Path | Path's}s.
|
|
30
|
+
* @defaultValue `[]`
|
|
15
31
|
*/
|
|
16
|
-
|
|
32
|
+
subPaths: Path[];
|
|
17
33
|
|
|
18
34
|
/**
|
|
19
|
-
* @
|
|
35
|
+
* The current {@link THREE.Path | Path} that is being generated.
|
|
36
|
+
* @defaultValue `null`
|
|
20
37
|
*/
|
|
21
|
-
|
|
38
|
+
readonly currentPath: Path | null;
|
|
22
39
|
|
|
23
40
|
/**
|
|
24
|
-
* @default
|
|
41
|
+
* {@link THREE.Color | Color} of the shape, by default set to white _(0xffffff)_.
|
|
42
|
+
* @defaultValue `new THREE.Color()`
|
|
25
43
|
*/
|
|
26
|
-
|
|
44
|
+
color: Color;
|
|
27
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Starts a new {@link THREE.Path | Path} and calls {@link THREE.Path.moveTo | Path.moveTo}( x, y ) on that {@link THREE.Path | Path}
|
|
48
|
+
* @remarks
|
|
49
|
+
* Also points {@link ShapePath.currentPath | currentPath} to that {@link THREE.Path | Path}.
|
|
50
|
+
* @param x Expects a `Float`
|
|
51
|
+
* @param y Expects a `Float`
|
|
52
|
+
*/
|
|
28
53
|
moveTo(x: number, y: number): this;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* This creates a line from the {@link ShapePath.currentPath | currentPath}'s offset to X and Y and updates the offset to X and Y.
|
|
57
|
+
* @param x Expects a `Float`
|
|
58
|
+
* @param y Expects a `Float`
|
|
59
|
+
*/
|
|
29
60
|
lineTo(x: number, y: number): this;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* This creates a quadratic curve from the {@link ShapePath.currentPath | currentPath}'s
|
|
64
|
+
* offset to _x_ and _y_ with _cpX_ and _cpY_ as control point and updates the {@link ShapePath.currentPath | currentPath}'s offset to _x_ and _y_.
|
|
65
|
+
* @param cpX Expects a `Float`
|
|
66
|
+
* @param cpY Expects a `Float`
|
|
67
|
+
* @param x Expects a `Float`
|
|
68
|
+
* @param y Expects a `Float`
|
|
69
|
+
*/
|
|
30
70
|
quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): this;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* This creates a bezier curve from the {@link ShapePath.currentPath | currentPath}'s
|
|
74
|
+
* offset to _x_ and _y_ with _cp1X_, _cp1Y_ and _cp2X_, _cp2Y_ as control points and
|
|
75
|
+
* updates the {@link ShapePath.currentPath | currentPath}'s offset to _x_ and _y_.
|
|
76
|
+
* @param cp1X Expects a `Float`
|
|
77
|
+
* @param cp1Y Expects a `Float`
|
|
78
|
+
* @param cp2X Expects a `Float`
|
|
79
|
+
* @param cp2Y Expects a `Float`
|
|
80
|
+
* @param x Expects a `Float`
|
|
81
|
+
* @param y Expects a `Float`
|
|
82
|
+
*/
|
|
31
83
|
bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): this;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Connects a new {@link THREE.SplineCurve | SplineCurve} onto the {@link ShapePath.currentPath | currentPath}.
|
|
87
|
+
* @param points An array of {@link THREE.Vector2 | Vector2}s
|
|
88
|
+
*/
|
|
32
89
|
splineThru(pts: Vector2[]): this;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Converts the {@link ShapePath.subPaths | subPaths} array into an array of Shapes
|
|
93
|
+
* @remarks
|
|
94
|
+
* By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW)
|
|
95
|
+
* If isCCW is set to true, then those are flipped.
|
|
96
|
+
* @param isCCW Changes how solids and holes are generated
|
|
97
|
+
*/
|
|
33
98
|
toShapes(isCCW: boolean): Shape[];
|
|
34
99
|
}
|
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
import { EllipseCurve } from './EllipseCurve';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Alias for {@link THREE.EllipseCurve | EllipseCurve}.
|
|
5
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/ArcCurve | Official Documentation}
|
|
6
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/ArcCurve.js | Source}
|
|
7
|
+
*/
|
|
2
8
|
export class ArcCurve extends EllipseCurve {
|
|
3
|
-
|
|
9
|
+
/**
|
|
10
|
+
* This constructor creates a new {@link ArcCurve}.
|
|
11
|
+
* @param aX The X center of the ellipse. Expects a `Float`. Default is `0`.
|
|
12
|
+
* @param aY The Y center of the ellipse. Expects a `Float`. Default is `0`.
|
|
13
|
+
* @param xRadius The radius of the ellipse in the x direction. Expects a `Float`. Default is `1`.
|
|
14
|
+
* @param yRadius The radius of the ellipse in the y direction. Expects a `Float`. Default is `1`.
|
|
15
|
+
* @param aStartAngle The start angle of the curve in radians starting from the positive X axis. Default is `0`.
|
|
16
|
+
* @param aEndAngle The end angle of the curve in radians starting from the positive X axis. Default is `2 x Math.PI`.
|
|
17
|
+
* @param aClockwise Whether the ellipse is drawn clockwise. Default is `false`.
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
aX?: number,
|
|
21
|
+
aY?: number,
|
|
22
|
+
aRadius?: number,
|
|
23
|
+
aStartAngle?: number,
|
|
24
|
+
aEndAngle?: number,
|
|
25
|
+
aClockwise?: boolean,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Read-only flag to check if a given object is of type {@link ArcCurve}.
|
|
30
|
+
* @remarks This is a _constant_ value
|
|
31
|
+
* @defaultValue `true`
|
|
32
|
+
*/
|
|
33
|
+
readonly isArcCurve = true;
|
|
4
34
|
|
|
5
35
|
/**
|
|
6
|
-
*
|
|
36
|
+
* A Read-only _string_ to check if `this` object type.
|
|
37
|
+
* @remarks Sub-classes will update this value.
|
|
38
|
+
* @defaultValue `ArcCurve`
|
|
7
39
|
*/
|
|
8
|
-
type: string;
|
|
40
|
+
override readonly type: string | 'ArcCurve';
|
|
9
41
|
}
|
|
@@ -1,30 +1,77 @@
|
|
|
1
1
|
import { Vector3 } from './../../math/Vector3';
|
|
2
2
|
import { Curve } from './../core/Curve';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export namespace CurveUtils {
|
|
6
|
-
function tangentQuadraticBezier(t: number, p0: number, p1: number, p2: number): number;
|
|
7
|
-
function tangentCubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number;
|
|
8
|
-
function tangentSpline(t: number, p0: number, p1: number, p2: number, p3: number): number;
|
|
9
|
-
function interpolate(p0: number, p1: number, p2: number, p3: number, t: number): number;
|
|
10
|
-
}
|
|
4
|
+
export type CurveType = 'centripetal' | 'chordal' | 'catmullrom';
|
|
11
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Create a smooth **3D** spline curve from a series of points using the {@link https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline | Catmull-Rom} algorithm.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* //Create a closed wavey loop
|
|
11
|
+
* const curve = new THREE.CatmullRomCurve3([
|
|
12
|
+
* new THREE.Vector3(-10, 0, 10),
|
|
13
|
+
* new THREE.Vector3(-5, 5, 5),
|
|
14
|
+
* new THREE.Vector3(0, 0, 0),
|
|
15
|
+
* new THREE.Vector3(5, -5, 5),
|
|
16
|
+
* new THREE.Vector3(10, 0, 10)]);
|
|
17
|
+
* const points = curve.getPoints(50);
|
|
18
|
+
* const geometry = new THREE.BufferGeometry().setFromPoints(points);
|
|
19
|
+
* const material = new THREE.LineBasicMaterial({
|
|
20
|
+
* color: 0xff0000
|
|
21
|
+
* });
|
|
22
|
+
* // Create the final object to add to the scene
|
|
23
|
+
* const curveObject = new THREE.Line(geometry, material);
|
|
24
|
+
* ```
|
|
25
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_extrude_splines | WebGL / geometry / extrude / splines}
|
|
26
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/CatmullRomCurve3 | Official Documentation}
|
|
27
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CatmullRomCurve3.js | Source}
|
|
28
|
+
*/
|
|
12
29
|
export class CatmullRomCurve3 extends Curve<Vector3> {
|
|
13
30
|
/**
|
|
14
|
-
* @
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
31
|
+
* This constructor creates a new {@link CatmullRomCurve3}.
|
|
32
|
+
* @param points An array of {@link THREE.Vector3 | Vector3} points
|
|
33
|
+
* @param closed Whether the curve is closed. Default `false`
|
|
34
|
+
* @param curveType Type of the curve. Default `centripetal`
|
|
35
|
+
* @param tension Tension of the curve. Expects a `Float`. Default `0.5`
|
|
36
|
+
*/
|
|
37
|
+
constructor(points?: Vector3[], closed?: boolean, curveType?: CurveType, tension?: number);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Read-only flag to check if a given object is of type {@link CatmullRomCurve3}.
|
|
41
|
+
* @remarks This is a _constant_ value
|
|
42
|
+
* @defaultValue `true`
|
|
43
|
+
*/
|
|
44
|
+
readonly isCatmullRomCurve3 = true;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A Read-only _string_ to check if `this` object type.
|
|
48
|
+
* @remarks Sub-classes will update this value.
|
|
49
|
+
* @defaultValue `CatmullRomCurve3`
|
|
18
50
|
*/
|
|
19
|
-
|
|
51
|
+
override readonly type: string | 'CatmullRomCurve3';
|
|
20
52
|
|
|
21
53
|
/**
|
|
22
|
-
*
|
|
54
|
+
* The curve will loop back onto itself when this is true.
|
|
55
|
+
* @defaultValue `false`
|
|
23
56
|
*/
|
|
24
|
-
|
|
57
|
+
closed: boolean;
|
|
25
58
|
|
|
26
59
|
/**
|
|
27
|
-
* @
|
|
60
|
+
* The array of {@link THREE.Vector3 | Vector3} points that define the curve.
|
|
61
|
+
* @remarks It needs at least two entries.
|
|
62
|
+
* @defaultValue `[]`
|
|
28
63
|
*/
|
|
29
64
|
points: Vector3[];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Possible values are `centripetal`, `chordal` and `catmullrom`.
|
|
68
|
+
* @defaultValue `centripetal`
|
|
69
|
+
*/
|
|
70
|
+
curveType: CurveType;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* When {@link .curveType} is `catmullrom`, defines catmullrom's tension.
|
|
74
|
+
* @remarks Expects a `Float`
|
|
75
|
+
*/
|
|
76
|
+
tension: number;
|
|
30
77
|
}
|
|
@@ -1,31 +1,72 @@
|
|
|
1
1
|
import { Vector2 } from './../../math/Vector2';
|
|
2
2
|
import { Curve } from './../core/Curve';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Create a smooth **2D** {@link http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:Bezier_curve.svg | cubic bezier curve},
|
|
6
|
+
* defined by a start point, endpoint and two control points.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const curve = new THREE.CubicBezierCurve(
|
|
10
|
+
* new THREE.Vector2(-10, 0),
|
|
11
|
+
* new THREE.Vector2(-5, 15),
|
|
12
|
+
* new THREE.Vector2(20, 15),
|
|
13
|
+
* new THREE.Vector2(10, 0));
|
|
14
|
+
* const points = curve.getPoints(50);
|
|
15
|
+
* const geometry = new THREE.BufferGeometry().setFromPoints(points);
|
|
16
|
+
* const material = new THREE.LineBasicMaterial({
|
|
17
|
+
* color: 0xff0000
|
|
18
|
+
* });
|
|
19
|
+
* // Create the final object to add to the scene
|
|
20
|
+
* const curveObject = new THREE.Line(geometry, material);
|
|
21
|
+
* ```
|
|
22
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/CubicBezierCurve | Official Documentation}
|
|
23
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CubicBezierCurve.js | Source}
|
|
24
|
+
*/
|
|
4
25
|
export class CubicBezierCurve extends Curve<Vector2> {
|
|
5
|
-
|
|
26
|
+
/**
|
|
27
|
+
* This constructor creates a new {@link CubicBezierCurve}.
|
|
28
|
+
* @param v0 The starting point. Default is `new THREE.Vector2()`.
|
|
29
|
+
* @param v1 The first control point. Default is `new THREE.Vector2()`.
|
|
30
|
+
* @param v2 The second control point. Default is `new THREE.Vector2()`.
|
|
31
|
+
* @param v3 The ending point. Default is `new THREE.Vector2()`.
|
|
32
|
+
*/
|
|
33
|
+
constructor(v0?: Vector2, v1?: Vector2, v2?: Vector2, v3?: Vector2);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Read-only flag to check if a given object is of type {@link CubicBezierCurve}.
|
|
37
|
+
* @remarks This is a _constant_ value
|
|
38
|
+
* @defaultValue `true`
|
|
39
|
+
*/
|
|
40
|
+
readonly isCubicBezierCurve = true;
|
|
6
41
|
|
|
7
42
|
/**
|
|
8
|
-
*
|
|
43
|
+
* A Read-only _string_ to check if `this` object type.
|
|
44
|
+
* @remarks Sub-classes will update this value.
|
|
45
|
+
* @defaultValue `CubicBezierCurve`
|
|
9
46
|
*/
|
|
10
|
-
type: string;
|
|
47
|
+
override readonly type: string | 'CubicBezierCurve';
|
|
11
48
|
|
|
12
49
|
/**
|
|
13
|
-
*
|
|
50
|
+
* The starting point.
|
|
51
|
+
* @defaultValue `new THREE.Vector2()`
|
|
14
52
|
*/
|
|
15
53
|
v0: Vector2;
|
|
16
54
|
|
|
17
55
|
/**
|
|
18
|
-
*
|
|
56
|
+
* The first control point.
|
|
57
|
+
* @defaultValue `new THREE.Vector2()`
|
|
19
58
|
*/
|
|
20
59
|
v1: Vector2;
|
|
21
60
|
|
|
22
61
|
/**
|
|
23
|
-
*
|
|
62
|
+
* The second control point.
|
|
63
|
+
* @defaultValue `new THREE.Vector2()`
|
|
24
64
|
*/
|
|
25
65
|
v2: Vector2;
|
|
26
66
|
|
|
27
67
|
/**
|
|
28
|
-
*
|
|
68
|
+
* The ending point.
|
|
69
|
+
* @defaultValue `new THREE.Vector2()`
|
|
29
70
|
*/
|
|
30
71
|
v3: Vector2;
|
|
31
72
|
}
|
|
@@ -1,31 +1,72 @@
|
|
|
1
1
|
import { Vector3 } from './../../math/Vector3';
|
|
2
2
|
import { Curve } from './../core/Curve';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Create a smooth **3D** {@link http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:Bezier_curve.svg | cubic bezier curve},
|
|
6
|
+
* defined by a start point, endpoint and two control points.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const curve = new THREE.CubicBezierCurve(
|
|
10
|
+
* new THREE.Vector2(-10, 0),
|
|
11
|
+
* new THREE.Vector2(-5, 15),
|
|
12
|
+
* new THREE.Vector2(20, 15),
|
|
13
|
+
* new THREE.Vector2(10, 0));
|
|
14
|
+
* const points = curve.getPoints(50);
|
|
15
|
+
* const geometry = new THREE.BufferGeometry().setFromPoints(points);
|
|
16
|
+
* const material = new THREE.LineBasicMaterial({
|
|
17
|
+
* color: 0xff0000
|
|
18
|
+
* });
|
|
19
|
+
* // Create the final object to add to the scene
|
|
20
|
+
* const curveObject = new THREE.Line(geometry, material);
|
|
21
|
+
* ```
|
|
22
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/CubicBezierCurve | Official Documentation}
|
|
23
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CubicBezierCurve.js | Source}
|
|
24
|
+
*/
|
|
4
25
|
export class CubicBezierCurve3 extends Curve<Vector3> {
|
|
5
|
-
|
|
26
|
+
/**
|
|
27
|
+
* This constructor creates a new {@link CubicBezierCurve3}.
|
|
28
|
+
* @param v0 The starting point. Default is `new THREE.Vector3()`.
|
|
29
|
+
* @param v1 The first control point. Default is `new THREE.Vector3()`.
|
|
30
|
+
* @param v2 The second control point. Default is `new THREE.Vector3()`.
|
|
31
|
+
* @param v3 The ending point. Default is `new THREE.Vector3()`.
|
|
32
|
+
*/
|
|
33
|
+
constructor(v0?: Vector3, v1?: Vector3, v2?: Vector3, v3?: Vector3);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Read-only flag to check if a given object is of type {@link CubicBezierCurve3}.
|
|
37
|
+
* @remarks This is a _constant_ value
|
|
38
|
+
* @defaultValue `true`
|
|
39
|
+
*/
|
|
40
|
+
readonly isCubicBezierCurve3 = true;
|
|
6
41
|
|
|
7
42
|
/**
|
|
8
|
-
*
|
|
43
|
+
* A Read-only _string_ to check if `this` object type.
|
|
44
|
+
* @remarks Sub-classes will update this value.
|
|
45
|
+
* @defaultValue `CubicBezierCurve3`
|
|
9
46
|
*/
|
|
10
|
-
type: string;
|
|
47
|
+
override readonly type: string | 'CubicBezierCurve3';
|
|
11
48
|
|
|
12
49
|
/**
|
|
13
|
-
*
|
|
50
|
+
* The starting point.
|
|
51
|
+
* @defaultValue `new THREE.Vector3()`.
|
|
14
52
|
*/
|
|
15
53
|
v0: Vector3;
|
|
16
54
|
|
|
17
55
|
/**
|
|
18
|
-
*
|
|
56
|
+
* The first control point.
|
|
57
|
+
* @defaultValue `new THREE.Vector3()`.
|
|
19
58
|
*/
|
|
20
59
|
v1: Vector3;
|
|
21
60
|
|
|
22
61
|
/**
|
|
23
|
-
*
|
|
62
|
+
* The second control point.
|
|
63
|
+
* @defaultValue `new THREE.Vector3()`.
|
|
24
64
|
*/
|
|
25
65
|
v2: Vector3;
|
|
26
66
|
|
|
27
67
|
/**
|
|
28
|
-
*
|
|
68
|
+
* The ending point.
|
|
69
|
+
* @defaultValue `new THREE.Vector3()`.
|
|
29
70
|
*/
|
|
30
71
|
v3: Vector3;
|
|
31
72
|
}
|
|
@@ -1,60 +1,115 @@
|
|
|
1
1
|
import { Curve } from './../core/Curve';
|
|
2
2
|
import { Vector2 } from '../../math/Vector2';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Creates a 2d curve in the shape of an ellipse
|
|
6
|
+
* @remarks
|
|
7
|
+
* Setting the {@link xRadius} equal to the {@link yRadius} will result in a circle.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const curve = new THREE.EllipseCurve(
|
|
11
|
+
* 0, 0, // ax, aY
|
|
12
|
+
* 10, 10, // xRadius, yRadius
|
|
13
|
+
* 0, 2 * Math.PI, // aStartAngle, aEndAngle
|
|
14
|
+
* false, // aClockwise
|
|
15
|
+
* 0 // aRotation
|
|
16
|
+
* );
|
|
17
|
+
* const points = curve.getPoints(50);
|
|
18
|
+
* const geometry = new THREE.BufferGeometry().setFromPoints(points);
|
|
19
|
+
* const material = new THREE.LineBasicMaterial({ color: 0xff0000 });
|
|
20
|
+
* // Create the final object to add to the scene
|
|
21
|
+
* const ellipse = new THREE.Line(geometry, material);
|
|
22
|
+
* ```
|
|
23
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/EllipseCurve | Official Documentation}
|
|
24
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/EllipseCurve.js | Source}
|
|
25
|
+
*/
|
|
4
26
|
export class EllipseCurve extends Curve<Vector2> {
|
|
27
|
+
/**
|
|
28
|
+
* This constructor creates a new {@link EllipseCurve}.
|
|
29
|
+
* @param aX The X center of the ellipse. Expects a `Float`. Default is `0`.
|
|
30
|
+
* @param aY The Y center of the ellipse. Expects a `Float`. Default is `0`.
|
|
31
|
+
* @param xRadius The radius of the ellipse in the x direction. Expects a `Float`. Default is `1`.
|
|
32
|
+
* @param yRadius The radius of the ellipse in the y direction. Expects a `Float`. Default is `1`.
|
|
33
|
+
* @param aStartAngle The start angle of the curve in radians starting from the positive X axis. Default is `0`.
|
|
34
|
+
* @param aEndAngle The end angle of the curve in radians starting from the positive X axis. Default is `2 x Math.PI`.
|
|
35
|
+
* @param aClockwise Whether the ellipse is drawn clockwise. Default is `false`.
|
|
36
|
+
* @param aRotation The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Default is `0`.
|
|
37
|
+
*/
|
|
5
38
|
constructor(
|
|
6
|
-
aX
|
|
7
|
-
aY
|
|
8
|
-
xRadius
|
|
9
|
-
yRadius
|
|
10
|
-
aStartAngle
|
|
11
|
-
aEndAngle
|
|
12
|
-
aClockwise
|
|
13
|
-
aRotation
|
|
39
|
+
aX?: number,
|
|
40
|
+
aY?: number,
|
|
41
|
+
xRadius?: number,
|
|
42
|
+
yRadius?: number,
|
|
43
|
+
aStartAngle?: number,
|
|
44
|
+
aEndAngle?: number,
|
|
45
|
+
aClockwise?: boolean,
|
|
46
|
+
aRotation?: number,
|
|
14
47
|
);
|
|
15
48
|
|
|
16
49
|
/**
|
|
17
|
-
* @
|
|
50
|
+
* Read-only flag to check if a given object is of type {@link EllipseCurve}.
|
|
51
|
+
* @remarks This is a _constant_ value
|
|
52
|
+
* @defaultValue `true`
|
|
53
|
+
*/
|
|
54
|
+
readonly isEllipseCurve = true;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A Read-only _string_ to check if `this` object type.
|
|
58
|
+
* @remarks Sub-classes will update this value.
|
|
59
|
+
* @defaultValue `EllipseCurve`
|
|
18
60
|
*/
|
|
19
|
-
type: string;
|
|
61
|
+
override readonly type: string | 'EllipseCurve';
|
|
20
62
|
|
|
21
63
|
/**
|
|
22
|
-
*
|
|
64
|
+
* The X center of the ellipse.
|
|
65
|
+
* @remarks Expects a `Float`
|
|
66
|
+
* @defaultValue `0`
|
|
23
67
|
*/
|
|
24
68
|
aX: number;
|
|
25
69
|
|
|
26
70
|
/**
|
|
27
|
-
*
|
|
71
|
+
* The Y center of the ellipse.
|
|
72
|
+
* @remarks Expects a `Float`
|
|
73
|
+
* @defaultValue `0`
|
|
28
74
|
*/
|
|
29
75
|
aY: number;
|
|
30
76
|
|
|
31
77
|
/**
|
|
32
|
-
*
|
|
78
|
+
* The radius of the ellipse in the x direction.
|
|
79
|
+
* @defaultValue `1`
|
|
33
80
|
*/
|
|
34
81
|
xRadius: number;
|
|
35
82
|
|
|
36
83
|
/**
|
|
37
|
-
*
|
|
84
|
+
* The radius of the ellipse in the y direction.
|
|
85
|
+
* @defaultValue `1`
|
|
38
86
|
*/
|
|
39
87
|
yRadius: number;
|
|
40
88
|
|
|
41
89
|
/**
|
|
42
|
-
*
|
|
90
|
+
* The start angle of the curve in radians starting from the middle right side.
|
|
91
|
+
* @remarks Expects a `Float`
|
|
92
|
+
* @defaultValue `0`
|
|
43
93
|
*/
|
|
44
94
|
aStartAngle: number;
|
|
45
95
|
|
|
46
96
|
/**
|
|
47
|
-
*
|
|
97
|
+
* The end angle of the curve in radians starting from the middle right side.
|
|
98
|
+
* @remarks Expects a `Float`
|
|
99
|
+
* @defaultValue `2 * Math.PI`
|
|
48
100
|
*/
|
|
49
101
|
aEndAngle: number;
|
|
50
102
|
|
|
51
103
|
/**
|
|
52
|
-
*
|
|
104
|
+
* Whether the ellipse is drawn clockwise.
|
|
105
|
+
* @defaultValue `false``
|
|
53
106
|
*/
|
|
54
107
|
aClockwise: boolean;
|
|
55
108
|
|
|
56
109
|
/**
|
|
57
|
-
*
|
|
110
|
+
* The rotation angle of the ellipse in radians, counterclockwise from the positive X axis (optional).
|
|
111
|
+
* @remarks Expects a `Float`
|
|
112
|
+
* @defaultValue `0`
|
|
58
113
|
*/
|
|
59
114
|
aRotation: number;
|
|
60
115
|
}
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
import { Vector2 } from './../../math/Vector2';
|
|
2
2
|
import { Curve } from './../core/Curve';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A curve representing a **2D** line segment.
|
|
6
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/LineCurve | Official Documentation}
|
|
7
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/LineCurve.js | Source}
|
|
8
|
+
*/
|
|
4
9
|
export class LineCurve extends Curve<Vector2> {
|
|
5
|
-
|
|
10
|
+
/**
|
|
11
|
+
* This constructor creates a new {@link LineCurve}.
|
|
12
|
+
* @param v1 The start point. Default is `new THREE.Vector2()`.
|
|
13
|
+
* @param v2 The end point. Default is `new THREE.Vector2()`.
|
|
14
|
+
*/
|
|
15
|
+
constructor(v1?: Vector2, v2?: Vector2);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Read-only flag to check if a given object is of type {@link LineCurve}.
|
|
19
|
+
* @remarks This is a _constant_ value
|
|
20
|
+
* @defaultValue `true`
|
|
21
|
+
*/
|
|
22
|
+
readonly isLineCurve = true;
|
|
6
23
|
|
|
7
24
|
/**
|
|
8
|
-
*
|
|
25
|
+
* A Read-only _string_ to check if `this` object type.
|
|
26
|
+
* @remarks Sub-classes will update this value.
|
|
27
|
+
* @defaultValue `LineCurve`
|
|
9
28
|
*/
|
|
10
|
-
type: string;
|
|
29
|
+
override readonly type: string | 'LineCurve';
|
|
11
30
|
|
|
12
31
|
/**
|
|
13
|
-
*
|
|
32
|
+
* The start point.
|
|
33
|
+
* @defaultValue `new THREE.Vector2()`
|
|
14
34
|
*/
|
|
15
35
|
v1: Vector2;
|
|
16
36
|
|
|
17
37
|
/**
|
|
18
|
-
*
|
|
38
|
+
* The end point
|
|
39
|
+
* @defaultValue `new THREE.Vector2()`
|
|
19
40
|
*/
|
|
20
41
|
v2: Vector2;
|
|
21
42
|
}
|