Package gaiasky.util.math
Class Planed
java.lang.Object
gaiasky.util.math.Planed
 All Implemented Interfaces:
Serializable
A plane defined via a unit length normal and the distance from the origin, as you learned in your math class.
 See Also:

Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum specifying on which side a point lies respective to the plane and it's normal. 
Field Summary

Constructor Summary
ConstructorDescriptionPlaned()
Constructs a new plane with all values set to 0Constructs a new plane based on the normal and distance to the origin.Constructs a new plane based on the normal and a point on the plane.Constructs a new plane out of the three given points that are considered to be on the plane. 
Method Summary
Modifier and TypeMethodDescriptiondouble
Calculates the shortest signed distance between the plane and the given point.double
getD()
boolean
isFrontFacing
(Vector3d direction) Returns whether the plane is facing the direction vector.void
set
(double nx, double ny, double nz, double d) Sets the plane normal and distancevoid
set
(double pointX, double pointY, double pointZ, double norX, double norY, double norZ) void
Sets this plane from the given planevoid
Sets the plane to the given point and normal.void
Sets the plane normal and distance to the origin based on the three given points which are considered to be on the plane.testPoint
(double x, double y, double z) Returns on which side the given point lies relative to the plane and its normal.Returns on which side the given point lies relative to the plane and its normal.toString()

Field Details

normal

d
public double d


Constructor Details

Planed
public Planed()Constructs a new plane with all values set to 0 
Planed
Constructs a new plane based on the normal and distance to the origin. Parameters:
normal
 The plane normald
 The distance to the origin

Planed
Constructs a new plane based on the normal and a point on the plane. Parameters:
normal
 The normalpoint
 The point on the plane

Planed
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 (point1point2)x(point2point3) Parameters:
point1
 The first pointpoint2
 The second pointpoint3
 The third point


Method Details

set
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 (point1point2)x(point2point3) Parameters:
point1
point2
point3


set
public void set(double nx, double ny, double nz, double d) Sets the plane normal and distance Parameters:
nx
 normal xcomponentny
 normal ycomponentnz
 normal zcomponentd
 distance to origin

distance
Calculates the shortest signed distance between the plane and the given point. Parameters:
point
 The point Returns:
 the shortest signed distance between the plane and the point

testPoint
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
 The point Returns:
 The side the point lies relative to the plane

testPoint
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:
x
y
z
 Returns:
 The side the point lies relative to the plane

isFrontFacing
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
 the direction Returns:
 whether the plane is front facing

getNormal
 Returns:
 The normal

getD
public double getD() Returns:
 The distance to the origin

set
Sets the plane to the given point and normal. Parameters:
point
 the point on the planenormal
 the normal of the plane

set
public void set(double pointX, double pointY, double pointZ, double norX, double norY, double norZ) 
set
Sets this plane from the given plane Parameters:
plane
 the plane

toString
