Skip to content

KBE3D / KBCore / Cesium / pointInsideTriangle

函数: pointInsideTriangle()

pointInsideTriangle(point: Cartesian3 | Cartesian2, p0: Cartesian3 | Cartesian2, p1: Cartesian3 | Cartesian2, p2: Cartesian3 | Cartesian2): boolean

Determines if a point is inside a triangle.

参数

point

The point to test.

Cartesian3 | Cartesian2

p0

The first point of the triangle.

Cartesian3 | Cartesian2

p1

The second point of the triangle.

Cartesian3 | Cartesian2

p2

The third point of the triangle.

Cartesian3 | Cartesian2

返回

boolean

true if the point is inside the triangle; otherwise, false.

示例

ts
// Returns true
const p = new Cesium.Cartesian2(0.25, 0.25);
const b = Cesium.pointInsideTriangle(p,
  new Cesium.Cartesian2(0.0, 0.0),
  new Cesium.Cartesian2(1.0, 0.0),
  new Cesium.Cartesian2(0.0, 1.0));

KBE3D @3.0.0 Copyright © 2024-present KBE3D