BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Curve.updateArcLengths()

概述

Curve.updateArcLengths()three.js 中的一种方法,用于更新曲线的弧长(arc length)。这个弧长是曲线上从起点到当前点的长度。该方法通常用于需要计算和绘制曲线上的点的场景。

用法

curve.updateArcLengths();

该方法不需要任何参数。只需调用该方法即可更新曲线的弧长。

注意:在调用 updateArcLengths() 方法之前,需要确保曲线已经通过 Curve.computeLengths() 方法计算出其长度。

示例

// 创建一个三次贝塞尔曲线
var curve = new THREE.CubicBezierCurve3(
  new THREE.Vector3( -10, 0, 0 ),
  new THREE.Vector3( -5, 15, 0 ),
  new THREE.Vector3( 20, 15, 0 ),
  new THREE.Vector3( 10, 0, 0 )
);

// 计算曲线长度
curve.computeLengths();

// 更新曲线弧长
curve.updateArcLengths();

参考资料