UNPKG

2.2 kBTypeScriptView Raw
1import { Vector3 } from "../../math/Vector3.js";
2import { Curve } from "../core/Curve.js";
3
4/**
5 * Create a smooth **3D** {@link http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:B%C3%A9zier_2_big.gif | quadratic bezier curve},
6 * defined by a start point, end point and a single control point.
7 * @example
8 * ```typescript
9 * const curve = new THREE.QuadraticBezierCurve3(
10 * new THREE.Vector3(-10, 0, 0),
11 * new THREE.Vector3(20, 15, 0),
12 * new THREE.Vector3(10, 0, 0));
13 * const points = curve.getPoints(50);
14 * const geometry = new THREE.BufferGeometry().setFromPoints(points);
15 * const material = new THREE.LineBasicMaterial({
16 * color: 0xff0000
17 * });
18 * // Create the final object to add to the scene
19 * const curveObject = new THREE.Line(geometry, material);
20 * ```
21 * @see {@link https://threejs.org/docs/index.html#api/en/extras/curves/QuadraticBezierCurve3 | Official Documentation}
22 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/curves/QuadraticBezierCurve3.js | Source}
23 */
24export class QuadraticBezierCurve3 extends Curve<Vector3> {
25 /**
26 * This constructor creates a new {@link QuadraticBezierCurve}.
27 * @param v0 The start point. Default is `new THREE.Vector3()`.
28 * @param v1 The control point. Default is `new THREE.Vector3()`.
29 * @param v2 The end point. Default is `new THREE.Vector3()`.
30 */
31 constructor(v0?: Vector3, v1?: Vector3, v2?: Vector3);
32
33 /**
34 * Read-only flag to check if a given object is of type {@link QuadraticBezierCurve3}.
35 * @remarks This is a _constant_ value
36 * @defaultValue `true`
37 */
38 readonly isQuadraticBezierCurve3 = true;
39
40 /**
41 * A Read-only _string_ to check if `this` object type.
42 * @remarks Sub-classes will update this value.
43 * @defaultValue `QuadraticBezierCurve3`
44 */
45 override readonly type: string | "QuadraticBezierCurve3";
46
47 /**
48 * The start point.
49 * @defaultValue `new THREE.Vector3()`
50 */
51 v0: Vector3;
52
53 /**
54 * The control point.
55 * @defaultValue `new THREE.Vector3()`
56 */
57 v1: Vector3;
58
59 /**
60 * The end point.
61 * @defaultValue `new THREE.Vector3()`
62 */
63 v2: Vector3;
64}