Appearance
KBE3D / KBCore / Cesium / Intersections2D / computeBarycentricCoordinates
函数: computeBarycentricCoordinates()
computeBarycentricCoordinates(
x:number,y:number,x1:number,y1:number,x2:number,y2:number,x3:number,y3:number,result?:Cartesian3):Cartesian3
Compute the barycentric coordinates of a 2D position within a 2D triangle.
参数
x
number
The x coordinate of the position for which to find the barycentric coordinates.
y
number
The y coordinate of the position for which to find the barycentric coordinates.
x1
number
The x coordinate of the triangle's first vertex.
y1
number
The y coordinate of the triangle's first vertex.
x2
number
The x coordinate of the triangle's second vertex.
y2
number
The y coordinate of the triangle's second vertex.
x3
number
The x coordinate of the triangle's third vertex.
y3
number
The y coordinate of the triangle's third vertex.
result?
The instance into to which to copy the result. If this parameter is undefined, a new instance is created and returned.
返回
The barycentric coordinates of the position within the triangle.
示例
ts
const result = Cesium.Intersections2D.computeBarycentricCoordinates(0.0, 0.0, 0.0, 1.0, -1, -0.5, 1, -0.5);
// result === new Cesium.Cartesian3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0);