VectorHelper

VectorHelper

VectorHelper 向量结构的帮助函数

Members

Methods

staticCalcBoundingBox(positions,start,count) → Box

计算点数组包围盒
Name Type Description
positions Vector3[] | Vector3Array 点数组
start number optional起始索引
count number optional个数

staticCalcBoundingBoxIndexed(positions,indices,indexStart,indexCount) → Box

计算索引点数组裁剪包围盒
Name Type Description
positions Vector3[] | Vector3Array 做标书组
indices number[] | Int32Array | Uint32Array 索引数组
indexStart number 索引起始值
indexCount number 索引个数

staticCalcNormals(positions,indices) → Vector3[]

计算法向量数组
Name Type Description
positions Vector3[] 点数组
indices number[] | Int32Array | Uint32Array 索引数组

staticCalcNormalsFloatArray(positions,indices) → Float32Array

从浮点数数组计算法向量
Name Type Description
positions Float32Array 浮点数数组
indices number[] | Int32Array | Uint32Array 索引数组

staticCloneVector3Array(points) → Array<Vector3>

复制三维点数组
Name Type Description
points Vector3[] 三维点数组

staticCreateBoundingBox(min,max) → BoundingBox

从最小最大点创建裁剪包围盒
Name Type Description
min Vector3
max Vector3

staticCreateBoundingBoxFromCenter(center,radius) → BoundingBox

从中心点和半径创建BoundingBox
Name Type Description
center Vector3 optional中心点
radius number optional半径

staticCreateBoundingInfo(min,max) → BoundingInfo

从最小最大点创建裁剪信息对象
Name Type Description
min Vector3
max Vector3

staticCreateRay(start,end) → Ray

创建Ray对象
Name Type Description
start Vector3 起点
end Vector3 终点

staticFilterDuplicatedVector2(points,minDis,clearPolyBeginEnd) → Vector2[]

过滤重复二维点
Name Type Description
points Vector2[] 点数组
minDis number optional最小距离
clearPolyBeginEnd boolean optional是否清除多边形起始重复点

staticFilterDuplicatedVector3(points,minDis,clearPolyBeginEnd) → Vector3[]

过滤重复三维点
Name Type Description
points Vector3[] 点数组
minDis number optional最小距离
clearPolyBeginEnd boolean optional是否清除多边形起始重复点

staticFloatToVector2Array(floats) → Array<Vector2>

从xy顺序排列浮点数组创建二维点数组,相邻两
Name Type Description
floats FloatArray 浮点数组

staticFloatToVector3Array(floats) → Array<Vector3>

从xyz顺序排列浮点数组创建三维点数组,相邻两
Name Type Description
floats FloatArray 浮点数组

staticInterpolateLineByCount(linePoints,count) → Vector3[]

根据指定的个数在折线上计算插值点
Name Type Description
linePoints Vector3[] 折线点
count number 中间插值点的个数

staticInterpolateLineByStep(linePoints,stepLen) → Vector3[]

根据指定的距离步长在折线上计算插值点,结束点如果不在准确步长上,将不会包括
Name Type Description
linePoints Vector3[] 折线点
stepLen number 步长,米

staticIntersectPlaneBox(plane,box) → boolean

判断平面是否与包围盒相交
Name Type Description
plane Plane 平面
box Box 包围盒

staticIntersectPlaneMinMax(plane,minimum,maximum) → boolean

判断平面是否与两对点定义的包围盒相交
Name Type Description
plane Plane 平面
minimum Vector3 最小点
maximum Vector3 最大点

staticIntersectRayBoundingBox(ray,boundingBox) → NullableValue<number>

判断射线是否与裁剪包围盒相交
Name Type Description
ray Ray
boundingBox BoundingBox

staticIntersectRayBox(ray,box) → NullableValue<number>

判断射线是否与包围盒相交
Name Type Description
ray Ray
box Box

staticIntersectRayMinMax(ray,minimum,maximum) → NullableValue<number>

判断射线是否与两点定义的包围盒相交
Name Type Description
ray Ray
minimum Vector3
maximum Vector3

staticIntersectRayTriangle(ray,v0,v1,v2) → IntersectionInfo

判断射线是否与三点定义的三角形相交
Name Type Description
ray Ray
v0 Vector3
v1 Vector3
v2 Vector3

staticMaxVector(v1,other) → Vector3

返回两个向量中个分量最大值构成的新向量
Name Type Description
v1 Vector3
other Vector3

staticMinVector(v1,other) → Vector3

返回两个向量中个分量最小值构成的新向量
Name Type Description
v1 Vector3
other Vector3

staticRayPosition(ray,distance) → Vector3

返回射线上与起点为指定距离的点坐标
Name Type Description
ray Ray
distance number

staticToColor3(c) → BABYLON.Color3

Color转为Color3
Name Type Description
c Color

staticToColor4(c) → BABYLON.Color4

Color转为Color4
Name Type Description
c Color

staticToLocalVector3Array(points,origin) → Array<Vector3>

点数组坐标转换为相对于origin点的局部坐标并返回
Name Type Description
points Vector3[] 坐标数组
origin Vector3 optional原点,可选,缺省使用第0点

staticToLocalVector3ArrayInPlace(points,origin)

点数组坐标转换为相对于origin点的局部,直接修改原数组中的值
Name Type Description
points Vector3[] 坐标数组
origin Vector3 optional原点,可选,缺省使用第0点

staticToVector2(v) → Vector2

Vector3转为Vector2
Name Type Description
v Vector3

staticToVector2Array(points) → Array<Vector2>

转为Vector2数组
Name Type Description
points Vector3[]

staticToVector3(point) → Vector3

Vector2转为Vector3,y值设为0
Name Type Description
point Vector2

staticToVector3Array(points) → Array<Vector3>

转为Vector3数组
Name Type Description
points Vector2[]

staticUnionBoxes(boundsArray) → Box

计算包围盒数组的包围盒
Name Type Description
boundsArray Array<Box>

staticVector2ArrayFromXyArray(xyArray) → Array<Vector2>

把开发员信息窗口中获取的xy格式数组转为Vector2数组
Name Type Description
xyArray number[][] xy格式数组

staticVector3ArrayFromXyzArray(xyzArray,specifiedY) → Array<Vector3>

把开发员信息窗口中获取的xyz格式数组转为Vector3数组
Name Type Description
xyzArray number[][] xyz格式数组
specifiedY number optional如果指定该值,则统一将y值赋为该值,否则保持原值