Three.js API手册

动画
AnimationAction AnimationClip AnimationMixer AnimationObjectGroup AnimationUtils KeyframeTrack PropertyBinding PropertyMixer
动画 / 轨道
BooleanKeyframeTrack ColorKeyframeTrack NumberKeyframeTrack QuaternionKeyframeTrack StringKeyframeTrack VectorKeyframeTrack
音频
Audio AudioAnalyser AudioContext AudioListener PositionalAudio
摄像机
ArrayCamera Camera CubeCamera OrthographicCamera PerspectiveCamera StereoCamera
常量
Animation Core CustomBlendingEquation DrawModes Materials Renderer Textures
核心
BufferAttribute BufferGeometry Clock DirectGeometry EventDispatcher Face3 Geometry InstancedBufferAttribute InstancedBufferGeometry InstancedInterleavedBuffer InterleavedBuffer InterleavedBufferAttribute Layers Object3D Raycaster Uniform
核心 / BufferAttributes
BufferAttribute_Types
弃用列表
DeprecatedList
附件
Earcut ShapeUtils
附件 / 核心
Curve CurvePath Font Interpolations Path Shape ShapePath
附件 / 曲线
ArcCurve CatmullRomCurve3 CubicBezierCurve CubicBezierCurve3 EllipseCurve LineCurve LineCurve3 QuadraticBezierCurve QuadraticBezierCurve3 SplineCurve
附件 / 物体
ImmediateRenderObject
几何体
BoxBufferGeometry BoxGeometry CircleBufferGeometry CircleGeometry ConeBufferGeometry ConeGeometry CylinderBufferGeometry CylinderGeometry DodecahedronBufferGeometry DodecahedronGeometry EdgesGeometry ExtrudeBufferGeometry ExtrudeGeometry IcosahedronBufferGeometry IcosahedronGeometry LatheBufferGeometry LatheGeometry OctahedronBufferGeometry OctahedronGeometry ParametricBufferGeometry ParametricGeometry PlaneBufferGeometry PlaneGeometry PolyhedronBufferGeometry PolyhedronGeometry RingBufferGeometry RingGeometry ShapeBufferGeometry ShapeGeometry SphereBufferGeometry SphereGeometry TetrahedronBufferGeometry TetrahedronGeometry TextBufferGeometry TextGeometry TorusBufferGeometry TorusGeometry TorusKnotBufferGeometry TorusKnotGeometry TubeBufferGeometry TubeGeometry WireframeGeometry
辅助对象
ArrowHelper AxesHelper BoxHelper Box3Helper CameraHelper DirectionalLightHelper FaceNormalsHelper GridHelper PolarGridHelper PositionalAudioHelper HemisphereLightHelper PlaneHelper PointLightHelper RectAreaLightHelper SkeletonHelper SpotLightHelper VertexNormalsHelper
灯光
AmbientLight DirectionalLight HemisphereLight Light PointLight RectAreaLight SpotLight
灯光 / 阴影
DirectionalLightShadow LightShadow SpotLightShadow
加载器
AnimationLoader AudioLoader BufferGeometryLoader Cache CompressedTextureLoader CubeTextureLoader DataTextureLoader FileLoader FontLoader ImageBitmapLoader ImageLoader Loader LoaderUtils MaterialLoader ObjectLoader TextureLoader
加载器 / 管理器
DefaultLoadingManager LoadingManager
材质
LineBasicMaterial LineDashedMaterial Material MeshBasicMaterial MeshDepthMaterial MeshDistanceMaterial MeshLambertMaterial MeshMatcapMaterial MeshNormalMaterial MeshPhongMaterial MeshPhysicalMaterial MeshStandardMaterial MeshToonMaterial PointsMaterial RawShaderMaterial ShaderMaterial ShadowMaterial SpriteMaterial
数学库
Box2 Box3 Color Cylindrical Euler Frustum Interpolant Line3 Math Matrix3 Matrix4 Plane Quaternion Ray Sphere Spherical Triangle Vector2 Vector3 Vector4
数学库 / 插值
CubicInterpolant DiscreteInterpolant LinearInterpolant QuaternionLinearInterpolant
物体
Bone Group Line LineLoop LineSegments LOD Mesh Points Skeleton SkinnedMesh Sprite
渲染器
WebGLMultisampleRenderTarget WebGLRenderer WebGLRenderTarget WebGLRenderTargetCube
渲染器 / 着色器
ShaderChunk ShaderLib UniformsLib UniformsUtils
场景
Fog FogExp2 Scene
纹理贴图
CanvasTexture CompressedTexture CubeTexture DataTexture DataTexture3D DepthTexture Texture VideoTexture
在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

三维几何线段(Line3)

用起点和终点表示的几何线段。

构造器(Constructor)

Line3( start : Vector3, end : Vector3 )

start - 线段的起始点。默认值为 (0, 0, 0)。
end - 线段的终点。默认值为 (0, 0, 0)。

创建一个三维几何线段 Line3。

属性(Properties)

# .start : Vector3

Vector3 表示线段的起点。

# .end : Vector3

Vector3 表示线段的终点

方法(Methods)

# .applyMatrix4 ( matrix : Matrix4 ) : Line3

对此线段应用矩阵变换。

# .at ( t : Float, target : Vector3 ) : Vector3

t - 使用值0-1返回沿线段的位置。
target — 计算结果会被拷贝到target。

返回一个线段某一位置的向量,当 t = 0的时候返回起始点,当t = 1的时候返回终点。

# .clone () : Line3

返回一个与此线段拥有相同起始点 start 和 终点end 的线段。

# .closestPointToPoint ( point : Vector3, clampToLine : Boolean, target : Vector3 ) : Vector3

point - 用于计算线段上到该点最近的点。
clampToLine - 是否将结果限制在线段起始点和终点之间。
target — 结果会拷贝到target。

返回线段上到point最近的点。如果参数 clampToLine 为true。返回值将会在线段之间。

# .closestPointToPointParameter ( point : Vector3, clampToLine : Boolean ) : Float

point - 用于计算返回值的点
clampToLine - 结果是否处于 [0, 1]之间。

返回一个基于点投影到线段上的点的参数。如果 clampToLine 为true则返回值将在0到1之间。

# .copy ( line : Line3 ) : Line3

拷贝传入线段的起始点 start 和终点 end 向量到当前线段。

# .delta ( target : Vector3 ) : Vector3

target — 结果将会拷贝到target。

返回线段的向量。(终点end向量减去起始点start向量)。

# .distance () : Float

Returns the Euclidean distance (straight-line distance) between the line's start and end points.

# .distanceSq () : Float

返回起始点start和终点end的欧几里得距离Euclidean distance。(直线距离)

# .equals ( line : Line3 ) : Boolean

line - Line3 to compare with this one.

如果给定线段与当前线段的起始点start和终点end都相同则返回true。

# .getCenter ( target : Vector3 ) : Vector3

target — 结果会写入target。

返回线段的中心点。

# .set ( start : Vector3, end : Vector3 ) : Line3

start - 设置线段的起点 start point。
end - 设置线段的终点 end point。

将传入的向量设置到线段的起始点和终点。

源码(Source)

src/math/Line3.js