de.jreality.math
Class P2

java.lang.Object
  extended by de.jreality.math.P2

public final class P2
extends Object

Static methods for geometry of the real projective plane RP2. Rn for method conventions and discussion of the ubiquitous metricnature parameter. Pn for other methods applicable in n-dimensional projective space.

Author:
Charles Gunn

Method Summary
static double[][] chopConvexPolygonWithLine(double[][] polygon, double[] line)
          The assumption is that the line is specified in such a way that vertices to be cut away have a negative inner product with the line coordinates.
static double[] imbedP2InP3(double[] vec4, double[] vec3)
          Convert (x,y,z) into (x,y,0,z)
static boolean isConvex(double[][] polygon)
          Returns true if and only if the polygon described by the point series polygon is convex.
static double[] lineFromPoints(double[] line, double[] p1, double[] p2)
          Calculate the line coordinates of the line connecting the two points p1 and p2.
static double[] perpendicularBisector(double[] dst, double[] p1, double[] p2, int metricnature)
          Calculate the perpendicular bisector of the segment p1 and p2 with metricnature metricnature
static double[] pointFromLines(double[] point, double[] l1, double[] l2)
          Calculate the homogeneous coordinates of the point of intersection of the two lines l1 and l2.
static boolean polygonContainsPoint(double[][] polygon, double[] point)
          Returns true if and only if point is within the polygon determined by the points contained in the array polygon.
static double[] projectP3ToP2(double[] vec3, double[] vec4)
          Convert the input (x,y,z,w) into (x,y,w).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

perpendicularBisector

public static double[] perpendicularBisector(double[] dst,
                                             double[] p1,
                                             double[] p2,
                                             int metricnature)
Calculate the perpendicular bisector of the segment p1 and p2 with metricnature metricnature

Parameters:
dst -
p1 -
p2 -
metricnature -
Returns:

pointFromLines

public static double[] pointFromLines(double[] point,
                                      double[] l1,
                                      double[] l2)
Calculate the homogeneous coordinates of the point of intersection of the two lines l1 and l2.

Parameters:
point -
l1 -
l2 -
Returns:

lineFromPoints

public static double[] lineFromPoints(double[] line,
                                      double[] p1,
                                      double[] p2)
Calculate the line coordinates of the line connecting the two points p1 and p2.

Parameters:
point -
l1 -
l2 -
Returns:

polygonContainsPoint

public static boolean polygonContainsPoint(double[][] polygon,
                                           double[] point)
Returns true if and only if point is within the polygon determined by the points contained in the array polygon.

Parameters:
polygon -
point -
Returns:

isConvex

public static boolean isConvex(double[][] polygon)
Returns true if and only if the polygon described by the point series polygon is convex.

Parameters:
polygon -
Returns:

chopConvexPolygonWithLine

public static double[][] chopConvexPolygonWithLine(double[][] polygon,
                                                   double[] line)
The assumption is that the line is specified in such a way that vertices to be cut away have a negative inner product with the line coordinates. The result is a new point array that defines the polygon obtained by cutting off all points with negative inner product with the given line. The polygon is assumed to be convex.

Parameters:
polygon -
line -
Returns:

projectP3ToP2

public static double[] projectP3ToP2(double[] vec3,
                                     double[] vec4)
Convert the input (x,y,z,w) into (x,y,w).

Parameters:
vec3 -
vec4 -
Returns:

imbedP2InP3

public static double[] imbedP2InP3(double[] vec4,
                                   double[] vec3)
Convert (x,y,z) into (x,y,0,z)

Parameters:
vec4 -
vec3 -
Returns: