crystalspace.jbind.impl.csgeom.plane2
Class csPlane2

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csgeom.plane2.csPlane2
All Implemented Interfaces:
iPointer

public class csPlane2
extends csNativeObject

A plane in 2D space. The plane is given by the equation AAx + BBy + CCz + DD = 0, Where (AA,BB,CC) is given by the vector 'norm'.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/pubapi/classcsPlane2.php

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csPlane2()
          Initialize to the xy plane.
csPlane2(csSegment2 s)
          Initialize the plane given a segment.
csPlane2(csVector2 plane_norm)
          Initialize the plane.
csPlane2(csVector2 v1, csVector2 v2)
          Initialize the plane given two vectors.
csPlane2(csVector2 plane_norm, float c)
          Initialize the plane.
csPlane2(float a, float b)
          Initialize the plane.
csPlane2(float a, float b, float c)
          Initialize the plane.
csPlane2(iPointer nPointer)
           
 
Method Summary
 float a()
          Return the A component of this plane.
 void a(float A)
          Return the A component of this plane.
 float b()
          Return the B component of this plane.
 void b(float B)
          Return the B component of this plane.
 float c()
          Return the C component of this plane.
 void c(float C)
          Return the C component of this plane.
 float cc()
          The C component of the plane.
 void cc(float CC)
          The C component of the plane.
 float classify(csVector2 pt)
          Classify the given vector with regards to this plane.
static float classify(float A, float B, float C, csVector2 pt)
          Classify a vector with regards to three plane components.
 float distance(csVector2 pt)
          Compute the distance from the given vector to this plane.
 csVector2 getNormal()
          Return the normal vector of this plane ( version).
 void invert()
          Reverses the direction of the plane while maintianing the plane itself.
protected  boolean isNativePointerValidSafe(long nPointer)
           
protected  void nDelete(long pointer)
           
 csVector2 norm()
          The normal vector (or the (A,B) components).
 void norm(csVector2 Norm)
          The normal vector (or the (A,B) components).
 csVector2 normal()
          Return the normal vector of this plane.
 void normalize()
          Normalizes the plane equation so that 'norm' is a unit vector.
 void set(csSegment2 s)
          Initialize the plane given a segment.
 void set(csVector2 v1, csVector2 v2)
          Initialize the plane given two vectors.
 void set(float a, float b, float c)
          Set the value of the four plane components.
 float squaredDistance(csVector2 pt)
          Compute the squared distance between the given vector and this plane.
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, equals, finalize, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

csPlane2

public csPlane2(iPointer nPointer)
Parameters:
nPointer -

csPlane2

public csPlane2()
Initialize to the xy plane. Definition at line 57 of file plane2.h. References CC.


csPlane2

public csPlane2(csVector2 plane_norm)
Initialize the plane. Definition at line 60 of file plane2.h. References CC.

Parameters:
plane_norm -

csPlane2

public csPlane2(csVector2 plane_norm,
                float c)
Initialize the plane. Definition at line 60 of file plane2.h. References CC.

Parameters:
plane_norm -
c -

csPlane2

public csPlane2(float a,
                float b)
Initialize the plane. Definition at line 63 of file plane2.h. References CC.

Parameters:
a -
b -

csPlane2

public csPlane2(float a,
                float b,
                float c)
Initialize the plane. Definition at line 63 of file plane2.h. References CC.

Parameters:
a -
b -
c -

csPlane2

public csPlane2(csVector2 v1,
                csVector2 v2)
Initialize the plane given two vectors. Definition at line 80 of file plane2.h. References Set().

Parameters:
v1 -
v2 -

csPlane2

public csPlane2(csSegment2 s)
Initialize the plane given a segment. Definition at line 86 of file plane2.h. References Set().

Parameters:
s -
Method Detail

nDelete

protected void nDelete(long pointer)
Specified by:
nDelete in class csNativeObject
See Also:
csNativeObject.nDelete(long)

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long nPointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
crystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()

a

public float a()
Return the A component of this plane. Definition at line 105 of file plane2.h. References csVector2::x.

Returns:

a

public void a(float A)
Return the A component of this plane. Definition at line 98 of file plane2.h. References csVector2::x. Referenced by Classify().

Parameters:
A -

b

public float b()
Return the B component of this plane. Definition at line 107 of file plane2.h. References csVector2::y.

Returns:

b

public void b(float B)
Return the B component of this plane. Definition at line 100 of file plane2.h. References csVector2::y. Referenced by Classify().

Parameters:
B -

c

public float c()
Return the C component of this plane. Definition at line 109 of file plane2.h. References CC.

Returns:

c

public void c(float C)
Return the C component of this plane. Definition at line 102 of file plane2.h. References CC. Referenced by Classify().

Parameters:
C -

classify

public static float classify(float A,
                             float B,
                             float C,
                             csVector2 pt)
Classify a vector with regards to three plane components. Definition at line 119 of file plane2.h. References A(), B(), C(), csVector2::x, and csVector2::y.

Parameters:
A -
B -
C -
pt -
Returns:

classify

public float classify(csVector2 pt)
Classify the given vector with regards to this plane. Definition at line 116 of file plane2.h. References CC. Referenced by Distance(), SquaredDistance(), and csMath2::Visible().

Parameters:
pt -
Returns:

distance

public float distance(csVector2 pt)
Compute the distance from the given vector to this plane. This function assumes that 'norm' is a unit vector. If not, the function returns distance times the magnitude of 'norm'. Definition at line 128 of file plane2.h. References Classify().

Parameters:
pt -
Returns:

getNormal

public csVector2 getNormal()
Return the normal vector of this plane ( version). Definition at line 95 of file plane2.h.

Returns:

invert

public void invert()
Reverses the direction of the plane while maintianing the plane itself. Definition at line 143 of file plane2.h. References CC.


normal

public csVector2 normal()
Return the normal vector of this plane. Definition at line 92 of file plane2.h.

Returns:

normalize

public void normalize()
Normalizes the plane equation so that 'norm' is a unit vector. Definition at line 146 of file plane2.h. References CC, and csVector2::Norm().


set

public void set(float a,
                float b,
                float c)
Set the value of the four plane components. Definition at line 112 of file plane2.h. References CC, csVector2::x, and csVector2::y.

Parameters:
a -
b -
c -

set

public void set(csSegment2 s)
Initialize the plane given a segment. Definition at line 74 of file plane2.h. References csSegment2::End(), Set(), and csSegment2::Start().

Parameters:
s -

set

public void set(csVector2 v1,
                csVector2 v2)
Initialize the plane given two vectors. Definition at line 66 of file plane2.h. References CC, csVector2::x, and csVector2::y. Referenced by csPlane2(), and Set().

Parameters:
v1 -
v2 -

squaredDistance

public float squaredDistance(csVector2 pt)
Compute the squared distance between the given vector and this plane. This function works even if the plane is not normalized. Note that the returned distance will be negative if the point is left of the plane and positive otherwise. Definition at line 137 of file plane2.h. References Classify(), and csVector2::SquaredNorm().

Parameters:
pt -
Returns:

cc

public float cc()
The C component of the plane. Definition at line 54 of file plane2.h. Referenced by C(), Classify(), csPlane2(), Invert(), Normalize(), csIntersect2::PlaneNoTest(), csMath2::PlanesEqual(), and Set().

Returns:

cc

public void cc(float CC)
The C component of the plane. Definition at line 54 of file plane2.h. Referenced by C(), Classify(), csPlane2(), Invert(), Normalize(), csIntersect2::PlaneNoTest(), csMath2::PlanesEqual(), and Set().

Parameters:
CC -

norm

public csVector2 norm()
The normal vector (or the (A,B) components). Definition at line 51 of file plane2.h. Referenced by csIntersect2::PlaneNoTest(), and csMath2::PlanesEqual().

Returns:

norm

public void norm(csVector2 Norm)
The normal vector (or the (A,B) components). Definition at line 51 of file plane2.h. Referenced by csIntersect2::PlaneNoTest(), and csMath2::PlanesEqual().

Parameters:
Norm -