resonance 1.0.1
Loading...
Searching...
No Matches
plane.h File Reference
#include "math/vector3.h"
Include dependency graph for plane.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Plane
 Plane equation, padded to a PlayStation 2 quadword. More...
struct  Segment
 Two points that fix a line or a segment. More...

Functions

Plane TransformPlaneToWorld (const Plane &plane, const float *pXfm)
 Move a plane out of the space a transform is expressed in.
void InterpolateFourFloats (const float *pFrom, const float *pTo, float *pOut, float flT)
 Blend four consecutive floats linearly.
bool IntersectSegmentWithPlane (const Vector3 segment[2], const Plane &plane, float *pT)
 Find where a segment crosses a plane.
Segment IntersectPlanes (const Plane &first, const Plane &second)
 Find the line two planes meet along.
Vector3 IntersectPlanes (const Plane &first, const Plane &second, const Plane &third)
 Find the point three planes meet at.

Function Documentation

◆ TransformPlaneToWorld()

Plane TransformPlaneToWorld ( const Plane & plane,
const float * pXfm )

Move a plane out of the space a transform is expressed in.

The normal is rotated by the three basis rows on VU0 in macro mode, and the distance becomes the original distance less the dot of the translation row with the rotated normal.

Parameters
planeThe plane, in the space the transform maps from.
pXfmThe transform, four rows of four floats.
Returns
The plane in the space the transform maps to.
Ghidra address:
NTSC-U/C: 0x00550fa8
Ghidra address:
PAL: 0x005915e8

◆ InterpolateFourFloats()

void InterpolateFourFloats ( const float * pFrom,
const float * pTo,
float * pOut,
float flT )

Blend four consecutive floats linearly.

Each result is from + (to - from) * flT. TnlCameraRig::SetFrame() blends a camera screen rectangle with it. The title is inferred.

Parameters
pFromThe four values at flT of 0.
pToThe four values at flT of 1.
pOutReceives the four blended values.
flTThe blend weight.
Ghidra address:
NTSC-U/C: 0x00551078
Ghidra address:
PAL: 0x005916b8

◆ IntersectSegmentWithPlane()

bool IntersectSegmentWithPlane ( const Vector3 segment[2],
const Plane & plane,
float * pT )

Find where a segment crosses a plane.

The parameter is the signed distance of the start divided by the difference between the signed distances of the start and the end. It is stored whether or not the segment crosses the plane.

Parameters
segmentThe start and the end of the segment.
planeThe plane.
pTReceives the crossing as a fraction of the way from the start to the end.
Returns
Whether the fraction lies in [0, 1].
Ghidra address:
NTSC-U/C: 0x00551218
Ghidra address:
PAL: 0x00591858

◆ IntersectPlanes() [1/2]

Segment IntersectPlanes ( const Plane & first,
const Plane & second )

Find the line two planes meet along.

The direction is the cross product of the two normals, and the result is a point and that point plus the direction. The point comes from a segment test against pSecond whose start is the first normal scaled by the negated first distance and whose end is the cross product of the direction with the first normal. That end is a direction treated as a position. The point therefore lies on the second plane, and on the first only when the first distance is zero. The title is inferred.

Parameters
firstThe first plane.
secondThe second plane.
Returns
The point, then the point plus the direction.
Ghidra address:
NTSC-U/C: 0x0054fcf8
Ghidra address:
PAL: 0x00590338

◆ IntersectPlanes() [2/2]

Vector3 IntersectPlanes ( const Plane & first,
const Plane & second,
const Plane & third )

Find the point three planes meet at.

The line of the first two planes from IntersectPlanes() is tested against the third, and the point is the one the segment test places at its fraction along that line. The shipped program does not call it. The title is inferred.

Parameters
firstThe first plane.
secondThe second plane.
thirdThe third plane.
Returns
The point.
Ghidra address:
NTSC-U/C: 0x005510e0
Ghidra address:
PAL: 0x00591720