Appearance
KBE3D / KBCore / Cesium / barycentricCoordinates
函数: barycentricCoordinates()
barycentricCoordinates(
point:Cartesian3|Cartesian2,p0:Cartesian3|Cartesian2,p1:Cartesian3|Cartesian2,p2:Cartesian3|Cartesian2,result?:Cartesian3):Cartesian3|undefined
Computes the barycentric coordinates for a point with respect to a triangle.
参数
point
The point to test.
p0
The first point of the triangle, corresponding to the barycentric x-axis.
p1
The second point of the triangle, corresponding to the barycentric y-axis.
p2
The third point of the triangle, corresponding to the barycentric z-axis.
result?
The object onto which to store the result.
返回
Cartesian3 | undefined
The modified result parameter or a new Cartesian3 instance if one was not provided. If the triangle is degenerate the function will return undefined.
示例
ts
// Returns Cartesian3.UNIT_X
const p = new Cesium.Cartesian3(-1.0, 0.0, 0.0);
const b = Cesium.barycentricCoordinates(p,
new Cesium.Cartesian3(-1.0, 0.0, 0.0),
new Cesium.Cartesian3( 1.0, 0.0, 0.0),
new Cesium.Cartesian3( 0.0, 1.0, 1.0));