APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.math

public Class Plane

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable

A plane defined via a unit length normal and the distance from the origin, as you learned in your math class.
Author
[email protected]

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Plane.PlaneSide

Enum specifying on which side a point lies respective to the plane and it's normal.

Field Summary

Modifier and TypeField and Description
public float
d

public final Vector3
private static final long

Constructor Summary

AccessConstructor and Description
public
Plane()

Constructs a new plane with all values set to 0

public
Plane(Vector3
The plane normal
normal
,
float
The distance to the origin
d
)

Constructs a new plane based on the normal and distance to the origin.

public
Plane(Vector3
The normal
normal
,
Vector3
The point on the plane
point
)

Constructs a new plane based on the normal and a point on the plane.

public
Plane(Vector3
The first point
point1
,
Vector3
The second point
point2
,
Vector3
The third point
point3
)

Constructs a new plane out of the three given points that are considered to be on the plane.

Method Summary

Modifier and TypeMethod and Description
public float

Returns:

the shortest signed distance between the plane and the point
distance
(Vector3
The point
point
)

Calculates the shortest signed distance between the plane and the given point.

public float
getD()

Returns: The distance to the origin

public Vector3
getNormal()

Returns: The normal

public boolean

Returns:

whether the plane is front facing
isFrontFacing
(Vector3
the direction
direction
)

Returns whether the plane is facing the direction vector.

public void
set(Vector3 point1, Vector3 point2, Vector3 point3)

Sets the plane normal and distance to the origin based on the three given points which are considered to be on the plane.

public void
set(float
normal x-component
nx
,
float
normal y-component
ny
,
float
normal z-component
nz
,
float
distance to origin
d
)

Sets the plane normal and distance

public void
set(Vector3
the point on the plane
point
,
Vector3
the normal of the plane
normal
)

Sets the plane to the given point and normal.

public void
set(float pointX, float pointY, float pointZ, float norX, float norY, float norZ)

public void
set(Plane
the plane
plane
)

Sets this plane from the given plane

public Plane.PlaneSide

Returns:

The side the point lies relative to the plane
testPoint
(Vector3
The point
point
)

Returns on which side the given point lies relative to the plane and its normal.

public Plane.PlaneSide

Returns:

The side the point lies relative to the plane
testPoint
(float x, float y, float z)

Returns on which side the given point lies relative to the plane and its normal.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

dback to summary
public float d
normalback to summary
public final Vector3 normal
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

Planeback to summary
public Plane()

Constructs a new plane with all values set to 0

Planeback to summary
public Plane(Vector3 normal, float d)

Constructs a new plane based on the normal and distance to the origin.

Parameters
normal:Vector3

The plane normal

d:float

The distance to the origin

Planeback to summary
public Plane(Vector3 normal, Vector3 point)

Constructs a new plane based on the normal and a point on the plane.

Parameters
normal:Vector3

The normal

point:Vector3

The point on the plane

Planeback to summary
public Plane(Vector3 point1, Vector3 point2, Vector3 point3)

Constructs a new plane out of the three given points that are considered to be on the plane. The normal is calculated via a cross product between (point1-point2)x(point2-point3)

Parameters
point1:Vector3

The first point

point2:Vector3

The second point

point3:Vector3

The third point

Method Detail

distanceback to summary
public float distance(Vector3 point)

Calculates the shortest signed distance between the plane and the given point.

Parameters
point:Vector3

The point

Returns:float

the shortest signed distance between the plane and the point

getDback to summary
public float getD()
Returns:float

The distance to the origin

getNormalback to summary
public Vector3 getNormal()
Returns:Vector3

The normal

isFrontFacingback to summary
public boolean isFrontFacing(Vector3 direction)

Returns whether the plane is facing the direction vector. Think of the direction vector as the direction a camera looks in. This method will return true if the front side of the plane determined by its normal faces the camera.

Parameters
direction:Vector3

the direction

Returns:boolean

whether the plane is front facing

setback to summary
public void set(Vector3 point1, Vector3 point2, Vector3 point3)

Sets the plane normal and distance to the origin based on the three given points which are considered to be on the plane. The normal is calculated via a cross product between (point1-point2)x(point2-point3)

setback to summary
public void set(float nx, float ny, float nz, float d)

Sets the plane normal and distance

Parameters
nx:float

normal x-component

ny:float

normal y-component

nz:float

normal z-component

d:float

distance to origin

setback to summary
public void set(Vector3 point, Vector3 normal)

Sets the plane to the given point and normal.

Parameters
point:Vector3

the point on the plane

normal:Vector3

the normal of the plane

setback to summary
public void set(float pointX, float pointY, float pointZ, float norX, float norY, float norZ)
setback to summary
public void set(Plane plane)

Sets this plane from the given plane

Parameters
plane:Plane

the plane

testPointback to summary
public Plane.PlaneSide testPoint(Vector3 point)

Returns on which side the given point lies relative to the plane and its normal. PlaneSide.Front refers to the side the plane normal points to.

Parameters
point:Vector3

The point

Returns:Plane.PlaneSide

The side the point lies relative to the plane

testPointback to summary
public Plane.PlaneSide testPoint(float x, float y, float z)

Returns on which side the given point lies relative to the plane and its normal. PlaneSide.Front refers to the side the plane normal points to.

Returns:Plane.PlaneSide

The side the point lies relative to the plane

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

com.badlogic.gdx.math back to summary

public final Enum Plane.PlaneSide

extends Enum<Plane.PlaneSide>
Class Inheritance

Enum specifying on which side a point lies respective to the plane and it's normal. PlaneSide#Front is the side to which the normal points.
Author
mzechner

Field Summary

Modifier and TypeField and Description
public static final Plane.PlaneSide
public static final Plane.PlaneSide
public static final Plane.PlaneSide

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Plane.PlaneSide
public static Plane.PlaneSide[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Backback to summary
public static final Plane.PlaneSide Back
Frontback to summary
public static final Plane.PlaneSide Front
OnPlaneback to summary
public static final Plane.PlaneSide OnPlane

Constructor Detail

PlaneSideback to summary
private PlaneSide()

Method Detail

valueOfback to summary
public static Plane.PlaneSide valueOf(String name)
valuesback to summary
public static Plane.PlaneSide[] values()