Skip to content

KBE3D / KBCore / Cesium / IntersectionTests / trianglePlaneIntersection

函数: trianglePlaneIntersection()

trianglePlaneIntersection(p0: Cartesian3, p1: Cartesian3, p2: Cartesian3, plane: Plane): any

Computes the intersection of a triangle and a plane

参数

p0

Cartesian3

First point of the triangle

p1

Cartesian3

Second point of the triangle

p2

Cartesian3

Third point of the triangle

plane

Plane

Intersection plane

返回

any

An object with properties positions and indices, which are arrays that represent three triangles that do not cross the plane. (Undefined if no intersection exists)

示例

ts
const origin = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
const normal = ellipsoid.geodeticSurfaceNormal(origin);
const plane = Cesium.Plane.fromPointNormal(origin, normal);

const p0 = new Cesium.Cartesian3(...);
const p1 = new Cesium.Cartesian3(...);
const p2 = new Cesium.Cartesian3(...);

// convert the triangle composed of points (p0, p1, p2) to three triangles that don't cross the plane
const triangles = Cesium.IntersectionTests.trianglePlaneIntersection(p0, p1, p2, plane);

KBE3D @3.0.0 Copyright © 2024-present KBE3D