Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.rico.engine.geometry
Class Point3D

    java.lang.Object
      de.rico.engine.geometry.Point3D

All Implemented Interfaces:
  java.io.Serializable

    public class Point3D

extends java.lang.Object
implements java.io.Serializable

This class represents a point (or rather vector) in 3-dimensional space. In openGL terms you would call it a vertex.

Author:
  Frank Bruns
See Also:
  Serialized Form

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

### x

    public float x

### y

    public float y

### z

    public float z

Constructor Detail

### Point3D

    public Point3D(float x,
                   float y,
                   float z)

  Creates a new point (vertex) in three-dimensional space

  Parameters:
    `x` - x-coordinate of the 3D point
    `y` - y-coordinate of the 3D point
    `z` - z-coordinate of the 3D point

### Point3D

    public Point3D(Point3D point)

  Creates a new point from the specified point.

  Parameters:
    `point` - point to create a new point from

### Point3D

    public Point3D()

  Creates a new point (vertex) in three-dimensional space that has the coordinates (0,0,0);

Method Detail

### getNormal

    public float[] getNormal()

  Returns a float array representing the vertex' normal

  Returns:
    normal of the vertex

### getNormalAsPoint3D

    public Point3D getNormalAsPoint3D()

  Returns the normal as a Point3D object

  Returns:
    normal of the vertex

### setNormal

    public void setNormal(float x,
                          float y,
                          float z)

  Sets the normal of this vertex to the specified values

  Parameters:
    `x` - x-coordinate
    `y` - y-coordinate
    `z` - z-coordinate

### setNormal

    public void setNormal(Point3D normal)

  Sets the normal of the vertex to the specified normal

  Parameters:
    `normal` - normal for the vertex

### setTo

    public void setTo(Point3D point)

  Sets the point to the coordinates of the given point

  Parameters:
    `point` - point with new coordinates

### setTo

    public void setTo(float x,
                      float y,
                      float z)

  Sets the point to new coordinates

  Parameters:
    `x` - new x-coordinate
    `y` - new y-coordinate
    `z` - new z-coordinate

### equals

    public boolean equals(Point3D point)

  Checks if this point is equal to the given point. If the coordinates of the two points are the same "true" is returned, else "false".

  Parameters:
    `point` -
  Returns:
    "true" if equal, "false" if not equal

### equals

    public boolean equals(Point3D point,
                          float tolerance)

  Checks if this point is equal to the specified coordinates. This method uses the specified tolerance while checking for equality.

  Parameters:
    `point` - point to check for equality with this point
    `tolerance` - tolerance to be used in the comparision process
  Returns:
    "true" if equal, "false" if not equal

### equals

    public boolean equals(float x,
                          float y,
                          float z)

  Checks if this point is equal to the specified coordinates.

  Parameters:
    `x` - x-coordinate
    `y` - y-coordinate
    `z` - z-coordinate
  Returns:
    "true" if equal, "false" if not equal

### equals

    public boolean equals(float x,
                          float y,
                          float z,
                          float tolerance)

  Checks if this point is equal to the specified coordinates. This method uses the specified tolerance while checking for equality.

  Parameters:
    `x` - x-coordinate
    `y` - y-coordinate
    `z` - z-coordinate
    `tolerance` - tolerance to be used in the comparision process
  Returns:
    "true" if equal, "false" if not equal

### clone

    public Point3D clone()

  Overrides:
    `clone` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### add

    public void add(float x,
                    float y,
                    float z)

  Adds the given parameters to this point

  Parameters:
    `x` - x-coordinate
    `y` - y-coordinate
    `z` - z-coordinate

### add

    public void add(Point3D point)

  Adds the specified point to this point

  Parameters:
    `point` - point to add

### add

    public static Point3D add(Point3D p1,
                              Point3D p2)

  Adds p1 and p2 and returns the result as a Point3D object

  Parameters:
    `p1` - summand 1
    `p2` - summand 2

### subtract

    public void subtract(float x,
                         float y,
                         float z)

  Subtracts the given parameters from this point

  Parameters:
    `x` - x-coordinate
    `y` - y-coordinate
    `z` - z-coordinate

### subtract

    public void subtract(Point3D point)

  Subtracts the specified point from this point

  Parameters:
    `point` - point to add

### subtract

    public static Point3D subtract(Point3D p1,
                                   Point3D p2)

  Subtracts p1 from p2 and returns the result as a Point3D object

  Parameters:
    `p1` - subtrahent
    `p2` - minuend

### multiply

    public void multiply(float scalar)

  Multiplies the point by the specified scalar

  Parameters:
    `scalar` - scalar to multiply by

### scale

    public void scale(float scaleX,
                      float scaleY,
                      float scaleZ)

  Scales the point by the specified parameters.

  Parameters:
    `scaleX` - scale factor for x
    `scaleY` - scale factor for y
    `scaleZ` - scale factor for z

### scaleAdd

    public void scaleAdd(float scalar,
                         Point3D p)

  At first multiplies this point by the scalar value and then adds the specified point.

  Parameters:
    `scalar` - scalar value
    `p` - point to add

### scaleAdd

    public 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. The point is returned as a new Point3D object.

  Parameters:
    `scalar` - scalar value
    `p1` - point1 (gets multiplied by scalar value)
    `p2` - point 2 (is added to the result of scalar*p1)
  Returns:
    resulting point

### multiply

    public static Point3D multiply(Point3D p,
                                   float scalar)

  Multiplies the specified pointby the specified scalar values and returns the result as a Point3D object

  Parameters:
    `p` - point to multiply
    `scalar` - scalar to multiply by

### divide

    public void divide(float scalar)

  Divides the point by the specified scalar

  Parameters:
    `scalar` - scalar to divide by

### getLength

    public float getLength()

  Returns the length of this point (or rather vector)

  Returns:
    length of the point/vector

### getLengthSquare

    public float getLengthSquare()

  Returns the length in its squared version.

  Returns:
    length in squared version

### getDistance

    public float getDistance(Point3D p)

  Returns the distance between this point and the specified one.
  Note: This method uses the expensive square root function.

  Parameters:
    `p` - point to find the distance to
  Returns:
    distance to the other point.

### getDistance

    public static float getDistance(Point3D p1,
                                    Point3D p2)

  Returns the distance between this point and the specified one.
  Note: This method uses the expensive square root function.

  Parameters:
    `p1` - starting point
    `p2` - point to find the distance to
  Returns:
    distance between the two points

### getDistanceSquared

    public float getDistanceSquared(Point3D p)

  Returns the distance between this point and the specified one in its squared version.

  Parameters:
    `p` - point to find the distance to
  Returns:
    square distance to the other point.

### getDistanceSquared

    public static float getDistanceSquared(Point3D p1,
                                           Point3D p2)

  Returns the distance between this point and the specified one in its squared version.

  Parameters:
    `p1` - starting point
    `p2` - point to find the distance to
  Returns:
    square distance between the two points

### getRounded

    public Point3D getRounded(int decimal)

  Returns a rounded version of the coordinates of the point.

  Parameters:
    `decimal` - decimal place (position after decimal point)
  Returns:
    returns a rounded version of the point

### getCrossProduct

    public static Point3D getCrossProduct(Point3D p1,
                                          Point3D p2)

  Returns the result of the cross product of two points/vectors

  Parameters:
    `p1` - point/vector 1
    `p2` - point/vector 2
  Returns:
    cross product of the two points/vectors

### getDotProduct

    public static float getDotProduct(Point3D p1,
                                      Point3D p2)

  Returns the dot product of the two points/vectors. The dot product is useful to find out whether two vectors are orthogonal to each other, because that is the case, if the dot product is 0.

  Parameters:
    `p1` - point/vector 1
    `p2` - point/vector 2
  Returns:
    dot product of the two points

### getDotProduct

    public float getDotProduct(Point3D point)

  Returns the dot product of this vector and the specified one. The dot product is useful to find out whether two vectors are orthogonal to each other, because that is the case, if the dot product is 0.

  Parameters:
    `point` - vector use for dot product
  Returns:
    dot product of the two points

### setToCrossProduct

    public void setToCrossProduct(Point3D p1,
                                  Point3D p2)

  Sets this point/vector to the result of the cross product of the two specified points/vectors

  Parameters:
    `p1` - point/vector 1
    `p2` - point/vector 2

### cross

    public void cross(Point3D point)

  Sets this point to the result of the cross product of this point and the specified one.

  Parameters:
    `point` - point to do the cross product with

### getAngle

    public float getAngle(Point3D point)

  Returns the angle in degrees between this vector and the specified one.
  Note: Can return the value NaN (e.g., if this vector is at (0f,0f,0f))

  Parameters:
    `point` - vector to use for angle calculation
  Returns:
    angle between this vector and the specified one

### getAngle

    public static float getAngle(Point3D p1,
                                 Point3D p2)

  Returns the angle in degrees between the two specified vectors. By convention the angle between two vectors is always the smaller one of the two possible angles. To get the bigger one you just have to subtract the result of this method from 360°.
  Note: Can return the value NaN (e.g., if a vector is at (0f,0f,0f))

  Parameters:
    `p1` - first vector to use for angle calculation
    `p2` - second vector to use for angle calculation
  Returns:
    angle between the two vectors

### normalize

    public void normalize()

  Converts this point (or rather vector) to a vector of length 1.

### invert

    public void invert()

  Inverts the sign of each coordinate of the point.

### getInverted

    public Point3D getInverted()

  Returns an inverted version of the point.

  Returns:
    inverted version of the point

### cutMantissa

    public void cutMantissa()

  This method cuts the mantissa (numbers after the decimal point) from each coordinate of the point.

### round

    public void round()

  This methods rounds the coordinates in the point

### rotateX

    public void rotateX(float angle)

  Rotates this vector along its x-axis by the specied angle

  Parameters:
    `angle` - angle in degrees to rotate the vector

### rotateY

    public void rotateY(float angle)

  Rotates this vector along its y-axis by the specied angle

  Parameters:
    `angle` - angle in degrees to rotate the vector

### rotateZ

    public void rotateZ(float angle)

  Rotates this vector along its z-axis by the specied angle

  Parameters:
    `angle` - angle in degrees to rotate the vector

### rotate

    public void rotate(float angleX,
                       float angleY,
                       float angleZ)

  Rotates this vector along its three axises

  Parameters:
    `angleX` - angle in degrees to rotate the x-axis of the vector
    `angleY` - angle in degrees to rotate the y-axis of the vector
    `angleZ` - angle in degrees to rotate the z-axis of the vector

### getX

    public float getX()

  Returns the x-coordinate of the 3D point (vertex)

  Returns:
    x-coordinate

### getY

    public float getY()

  Returns the y-coordinate of the 3D point (vertex)

  Returns:
    y-coordinate

### getZ

    public float getZ()

  Returns the z-coordinate of the 3D point (vertex)

  Returns:
    z-coordinate

### setX

    public void setX(float x)

  Sets the point's x-coordinate to the specified value

  Parameters:
    `x` - x-coordinate

### setY

    public void setY(float y)

  Sets the point's y-coordinate to the specified value

  Parameters:
    `y` - y-coordinate

### setZ

    public void setZ(float z)

  Sets the point's z-coordinate to the specified value

  Parameters:
    `z` - z-coordinate

### toArray

    public float[] toArray()

  Returns the point (vertex) with its 3D coordinates (x,y,z) as a float array

  Returns:
    3D point or rather vertex

### setTexCoords

    public void setTexCoords(float s,
                             float t)

  Sets the texture coordinates of the vertex to the specifies s and t values.

  Parameters:
    `s` - s-coordinate
    `t` - t-coordinate

### setTexCoords

    public void setTexCoords(TextureCoordinate texCoord)

  Sets the texture coordinates of the vertex to the specified texture coordinates

  Parameters:
    `texCoord` - texture coordinates object

### getTexCoord

    public TextureCoordinate getTexCoord()

  Returns the texture coordinate of the vertex

  Returns:
    texture coordinate of vertex2

### isWithinFrustum

    public boolean isWithinFrustum(ViewingFrustum frustum)

  Determines whethter or not this point is within the specified viewing frustum.

  Parameters:
    `frustum` - viewing frustum to check with
  Returns:
    is point in frustum? --> true=yes, false=no

### isWithinFrustum

    public boolean isWithinFrustum(Point3D point,
                                   ViewingFrustum frustum)

  Determines whethter or not the specified point is within the specified viewing frustum.

  Parameters:
    `point` - point to check with the frustum
    `frustum` - viewing frustum to check with
  Returns:
    is point in frustum? --> true=yes, false=no

### isOccluded

    public boolean isOccluded()

  Determines whether or not this point is occluded. This method makes use of OpenGL's built in gluProject() function.

  Returns:
    is point occluded? --> true=yes, false=no

### isOccluded

    public static boolean isOccluded(Point3D p)

  Determines whether or not the specified point is occluded. This method makes use of OpenGL's built in gluProject() function.

  Parameters:
    `p` - point to check for beeing occluded
  Returns:
    is point occluded? --> true=yes, false=no

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD