|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.rico.engine.geometry.Point3D
public class Point3D
This class represents a point (or rather vector) in 3-dimensional space. In openGL terms you would call it a vertex.
Field Summary | |
---|---|
float |
x
|
float |
y
|
float |
z
|
Constructor Summary | |
---|---|
Point3D()
Creates a new point (vertex) in three-dimensional space that has the coordinates (0,0,0); |
|
Point3D(float x,
float y,
float z)
Creates a new point (vertex) in three-dimensional space |
|
Point3D(Point3D point)
Creates a new point from the specified point. |
Method Summary | |
---|---|
void |
add(float x,
float y,
float z)
Adds the given parameters to this point |
void |
add(Point3D point)
Adds the specified point to this point |
static Point3D |
add(Point3D p1,
Point3D p2)
Adds p1 and p2 and returns the result as a Point3D object |
Point3D |
clone()
|
void |
cross(Point3D point)
Sets this point to the result of the cross product of this point and the specified one. |
void |
cutMantissa()
This method cuts the mantissa (numbers after the decimal point) from each coordinate of the point. |
void |
divide(float scalar)
Divides the point by the specified scalar |
boolean |
equals(float x,
float y,
float z)
Checks if this point is equal to the specified coordinates. |
boolean |
equals(float x,
float y,
float z,
float tolerance)
Checks if this point is equal to the specified coordinates. |
boolean |
equals(Point3D point)
Checks if this point is equal to the given point. |
boolean |
equals(Point3D point,
float tolerance)
Checks if this point is equal to the specified coordinates. |
float |
getAngle(Point3D point)
Returns the angle in degrees between this vector and the specified one. |
static float |
getAngle(Point3D p1,
Point3D p2)
Returns the angle in degrees between the two specified vectors. |
static Point3D |
getCrossProduct(Point3D p1,
Point3D p2)
Returns the result of the cross product of two points/vectors |
float |
getDistance(Point3D p)
Returns the distance between this point and the specified one. |
static float |
getDistance(Point3D p1,
Point3D p2)
Returns the distance between this point and the specified one. |
float |
getDistanceSquared(Point3D p)
Returns the distance between this point and the specified one in its squared version. |
static float |
getDistanceSquared(Point3D p1,
Point3D p2)
Returns the distance between this point and the specified one in its squared version. |
float |
getDotProduct(Point3D point)
Returns the dot product of this vector and the specified one. |
static float |
getDotProduct(Point3D p1,
Point3D p2)
Returns the dot product of the two points/vectors. |
Point3D |
getInverted()
Returns an inverted version of the point. |
float |
getLength()
Returns the length of this point (or rather vector) |
float |
getLengthSquare()
Returns the length in its squared version. |
float[] |
getNormal()
Returns a float array representing the vertex' normal |
Point3D |
getNormalAsPoint3D()
Returns the normal as a Point3D object |
Point3D |
getRounded(int decimal)
Returns a rounded version of the coordinates of the point. |
TextureCoordinate |
getTexCoord()
Returns the texture coordinate of the vertex |
float |
getX()
Returns the x-coordinate of the 3D point (vertex) |
float |
getY()
Returns the y-coordinate of the 3D point (vertex) |
float |
getZ()
Returns the z-coordinate of the 3D point (vertex) |
void |
invert()
Inverts the sign of each coordinate of the point. |
boolean |
isOccluded()
Determines whether or not this point is occluded. |
static boolean |
isOccluded(Point3D p)
Determines whether or not the specified point is occluded. |
boolean |
isWithinFrustum(Point3D point,
ViewingFrustum frustum)
Determines whethter or not the specified point is within the specified viewing frustum. |
boolean |
isWithinFrustum(ViewingFrustum frustum)
Determines whethter or not this point is within the specified viewing frustum. |
void |
multiply(float scalar)
Multiplies the point by the specified scalar |
static Point3D |
multiply(Point3D p,
float scalar)
Multiplies the specified pointby the specified scalar values and returns the result as a Point3D object |
void |
normalize()
Converts this point (or rather vector) to a vector of length 1. |
void |
rotate(float angleX,
float angleY,
float angleZ)
Rotates this vector along its three axises |
void |
rotateX(float angle)
Rotates this vector along its x-axis by the specied angle |
void |
rotateY(float angle)
Rotates this vector along its y-axis by the specied angle |
void |
rotateZ(float angle)
Rotates this vector along its z-axis by the specied angle |
void |
round()
This methods rounds the coordinates in the point |
void |
scale(float scaleX,
float scaleY,
float scaleZ)
Scales the point by the specified parameters. |
void |
scaleAdd(float scalar,
Point3D p)
At first multiplies this point by the scalar value and then adds the specified point. |
static Point3D |
scaleAdd(float scalar,
Point3D p1,
Point3D p2)
Multiplies the point p1 by the scalar value and then adds second point p2 to the result. |
void |
setNormal(float x,
float y,
float z)
Sets the normal of this vertex to the specified values |
void |
setNormal(Point3D normal)
Sets the normal of the vertex to the specified normal |
void |
setTexCoords(float s,
float t)
Sets the texture coordinates of the vertex to the specifies s and t values. |
void |
setTexCoords(TextureCoordinate texCoord)
Sets the texture coordinates of the vertex to the specified texture coordinates |
void |
setTo(float x,
float y,
float z)
Sets the point to new coordinates |
void |
setTo(Point3D point)
Sets the point to the coordinates of the given point |
void |
setToCrossProduct(Point3D p1,
Point3D p2)
Sets this point/vector to the result of the cross product of the two specified points/vectors |
void |
setX(float x)
Sets the point's x-coordinate to the specified value |
void |
setY(float y)
Sets the point's y-coordinate to the specified value |
void |
setZ(float z)
Sets the point's z-coordinate to the specified value |
void |
subtract(float x,
float y,
float z)
Subtracts the given parameters from this point |
void |
subtract(Point3D point)
Subtracts the specified point from this point |
static Point3D |
subtract(Point3D p1,
Point3D p2)
Subtracts p1 from p2 and returns the result as a Point3D object |
float[] |
toArray()
Returns the point (vertex) with its 3D coordinates (x,y,z) as a float array |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
public float z
Constructor Detail |
---|
public Point3D(float x, float y, float z)
x
- x-coordinate of the 3D pointy
- y-coordinate of the 3D pointz
- z-coordinate of the 3D pointpublic Point3D(Point3D point)
point
- point to create a new point frompublic Point3D()
Method Detail |
---|
public float[] getNormal()
public Point3D getNormalAsPoint3D()
public void setNormal(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void setNormal(Point3D normal)
normal
- normal for the vertexpublic void setTo(Point3D point)
point
- point with new coordinatespublic void setTo(float x, float y, float z)
x
- new x-coordinatey
- new y-coordinatez
- new z-coordinatepublic boolean equals(Point3D point)
point
-
public boolean equals(Point3D point, float tolerance)
point
- point to check for equality with this pointtolerance
- tolerance to be used in the comparision process
public boolean equals(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinate
public boolean equals(float x, float y, float z, float tolerance)
x
- x-coordinatey
- y-coordinatez
- z-coordinatetolerance
- tolerance to be used in the comparision process
public Point3D clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void add(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void add(Point3D point)
point
- point to addpublic static Point3D add(Point3D p1, Point3D p2)
p1
- summand 1p2
- summand 2public void subtract(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void subtract(Point3D point)
point
- point to addpublic static Point3D subtract(Point3D p1, Point3D p2)
p1
- subtrahentp2
- minuendpublic void multiply(float scalar)
scalar
- scalar to multiply bypublic void scale(float scaleX, float scaleY, float scaleZ)
scaleX
- scale factor for xscaleY
- scale factor for yscaleZ
- scale factor for zpublic void scaleAdd(float scalar, Point3D p)
scalar
- scalar valuep
- point to addpublic static Point3D scaleAdd(float scalar, Point3D p1, Point3D p2)
scalar
- scalar valuep1
- point1 (gets multiplied by scalar value)p2
- point 2 (is added to the result of scalar*p1)
public static Point3D multiply(Point3D p, float scalar)
p
- point to multiplyscalar
- scalar to multiply bypublic void divide(float scalar)
scalar
- scalar to divide bypublic float getLength()
public float getLengthSquare()
public float getDistance(Point3D p)
p
- point to find the distance to
public static float getDistance(Point3D p1, Point3D p2)
p1
- starting pointp2
- point to find the distance to
public float getDistanceSquared(Point3D p)
p
- point to find the distance to
public static float getDistanceSquared(Point3D p1, Point3D p2)
p1
- starting pointp2
- point to find the distance to
public Point3D getRounded(int decimal)
decimal
- decimal place (position after decimal point)
public static Point3D getCrossProduct(Point3D p1, Point3D p2)
p1
- point/vector 1p2
- point/vector 2
public static float getDotProduct(Point3D p1, Point3D p2)
p1
- point/vector 1p2
- point/vector 2
public float getDotProduct(Point3D point)
point
- vector use for dot product
public void setToCrossProduct(Point3D p1, Point3D p2)
p1
- point/vector 1p2
- point/vector 2public void cross(Point3D point)
point
- point to do the cross product withpublic float getAngle(Point3D point)
point
- vector to use for angle calculation
public static float getAngle(Point3D p1, Point3D p2)
p1
- first vector to use for angle calculationp2
- second vector to use for angle calculation
public void normalize()
public void invert()
public Point3D getInverted()
public void cutMantissa()
public void round()
public void rotateX(float angle)
angle
- angle in degrees to rotate the vectorpublic void rotateY(float angle)
angle
- angle in degrees to rotate the vectorpublic void rotateZ(float angle)
angle
- angle in degrees to rotate the vectorpublic void rotate(float angleX, float angleY, float angleZ)
angleX
- angle in degrees to rotate the x-axis of the vectorangleY
- angle in degrees to rotate the y-axis of the vectorangleZ
- angle in degrees to rotate the z-axis of the vectorpublic float getX()
public float getY()
public float getZ()
public void setX(float x)
x
- x-coordinatepublic void setY(float y)
y
- y-coordinatepublic void setZ(float z)
z
- z-coordinatepublic float[] toArray()
public void setTexCoords(float s, float t)
s
- s-coordinatet
- t-coordinatepublic void setTexCoords(TextureCoordinate texCoord)
texCoord
- texture coordinates objectpublic TextureCoordinate getTexCoord()
public boolean isWithinFrustum(ViewingFrustum frustum)
frustum
- viewing frustum to check with
public boolean isWithinFrustum(Point3D point, ViewingFrustum frustum)
point
- point to check with the frustumfrustum
- viewing frustum to check with
public boolean isOccluded()
public static boolean isOccluded(Point3D p)
p
- point to check for beeing occluded
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |