intersectPlane
是 Plane 类的一个方法,在给定平面的情况下计算该平面与另一个平面的交点,如果两个平面平行,则返回 null。
intersectPlane(plane: Plane): Vector3 | null
plane
:所要计算相交点的另一个平面,是一个 Plane 类型的实例。该方法将返回一个 Vector3 类型的交点,如果两个平面平行,则返回 null。
import { Plane } from 'yuka';
const planeA = new Plane();
planeA.setFromNormalAndCoplanarPoint( new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 0 ) );
const planeB = new Plane();
planeB.setFromNormalAndCoplanarPoint( new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ) );
const intersection = planeA.intersectPlane( planeB ); // null
import { Plane } from 'yuka';
const planeA = new Plane();
planeA.setFromNormalAndCoplanarPoint( new Vector3( -1, 0, 0 ), new Vector3( 0, 0, 0 ) );
const planeB = new Plane();
planeB.setFromNormalAndCoplanarPoint( new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ) );
const intersection = planeA.intersectPlane( planeB ); // Vector3( 0, 0, 0 )
本文档中的 intersectPlane
方法是 Yuka 库中 Plane 类的一个方法。