|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimogl.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.
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)
|
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 |
Point3D |
copy()
Returns a copy of this point |
void |
divide(float scalar)
Divides the point by the specified scalar |
Point3D |
getCrossProduct(Point3D p1,
Point3D p2)
Returns the result of the cross product of two points/vectors |
float |
getDotProduct(Point3D p1,
Point3D p2)
Returns the dot product of the two points/vectors. |
float |
getLength()
Returns the length of this point (or rather vector) |
float[] |
getPoint()
Returns the point (vertex) with its 3D coordinates (x,y,z) |
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) |
boolean |
isEqualTo(float x,
float y,
float z)
Checks if this point is equal to the specified coordinates |
boolean |
isEqualTo(Point3D point)
Checks if this point is equal to the given point. |
void |
multiply(float scalar)
Multiplies the point by the specified scalar |
void |
normalize()
Converts this point (or rather vector) to a vector of length 1. |
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 |
Point3D |
subtract(Point3D p1,
Point3D p2)
Subtracts p1 from p2 and returns the result as a Point3D object |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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)
public Point3D()
Method Detail |
---|
public 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 isEqualTo(Point3D point)
point
-
public boolean isEqualTo(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinate
public void add(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void add(Point3D point)
point
- point to addpublic void subtract(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void subtract(Point3D point)
point
- point to addpublic Point3D subtract(Point3D p1, Point3D p2)
p1
- subtrahentp2
- minuendpublic void multiply(float scalar)
scalar
- scalar to multiply bypublic void divide(float scalar)
scalar
- scalar to divide bypublic float getLength()
public Point3D getCrossProduct(Point3D p1, Point3D p2)
p1
- point/vector 1p2
- point/vector 2
public float getDotProduct(Point3D p1, Point3D p2)
p1
- point/vector 1p2
- point/vector 2
public void setToCrossProduct(Point3D p1, Point3D p2)
p1
- point/vector 1p2
- point/vector 2public void normalize()
public 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[] getPoint()
public Point3D copy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |