/** * Calculate the projection of a point on the plane defined by counter-clockwise (CCW) points A,B,C. * * @param Point The point to project onto the plane * @param A 1st of three points in CCW order defining the plane * @param B 2nd of three points in CCW order defining the plane * @param C 3rd of three points in CCW order defining the plane * @return Projection of Point onto plane ABC */ public static FVector PointPlaneProject(FVector Point, FVector A, FVector B, FVector C) { //Compute the plane normal from ABC FPlane Plane = new FPlane(A, B, C); //Find the distance of X from the plane //Add the distance back along the normal from the point return(Point - Plane * Plane.PlaneDot(Point)); }
/** * Calculate the projection of a point on the given plane. * * @param Point The point to project onto the plane * @param Plane The plane * @return Projection of Point onto Plane */ public static FVector PointPlaneProject(FVector Point, FPlane Plane) { return(Point - Plane * Plane.PlaneDot(Point)); }
/** * Mirrors a vector about a plane. * * @param Plane Plane to mirror about. * @return Mirrored vector. */ public FVector MirrorByPlane(FPlane Plane) { FPlane TempPlane = Plane * (2.0f * Plane.PlaneDot(this)); return(this - TempPlane);//new FVector(TempPlane.X,TempPlane.Y,TempPlane.Z); }