y25.graphics
Class Graphics3D

java.lang.Object
  extended byy25.graphics.Graphics3D

public class Graphics3D
extends Object

A utility class for drawing three dimensional primitives.


Constructor Summary
Graphics3D()
           
 
Method Summary
static void drawCone(GLAutoDrawable drawable, Point3D tipp, Point3D basee, float radius, int sides, boolean capped)
          Draws a cone.
static void drawCylinder(GLAutoDrawable drawable, Point3D fromm, Point3D too, float radius, int sides, boolean capped)
          Draws a cylinder.
static void drawCylinder(GLAutoDrawable drawable, Vector3D fromDir, Point3D from, Point3D to, Vector3D toDir, float radius, int sides, boolean capped)
          Draws a cylinder with a tilted top and bottom.
static Point3D project(Point3D p, Vector3D dir, Point3D origin, Vector3D normal)
          Projects a point p along the direction dir onto the plane that is defined by (origin,normal).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graphics3D

public Graphics3D()
Method Detail

drawCylinder

public static void drawCylinder(GLAutoDrawable drawable,
                                Point3D fromm,
                                Point3D too,
                                float radius,
                                int sides,
                                boolean capped)
Draws a cylinder.

Parameters:
drawable - the drawable that this drawing operations go to.
fromm - the start position of the cylinder.
too - the end position of the cylinder.
radius - the radius of the cylinder.
sides - the number of sides the cylinder will have. It must have at least 3 sides.
capped - determines if a cap should be drawn at the top and at the bottom of the cyliner.

drawCylinder

public static void drawCylinder(GLAutoDrawable drawable,
                                Vector3D fromDir,
                                Point3D from,
                                Point3D to,
                                Vector3D toDir,
                                float radius,
                                int sides,
                                boolean capped)
Draws a cylinder with a tilted top and bottom.

The tilt is determined by normals at the top and bottom of the cylinder.

Parameters:
drawable - the drawable that this drawing operations go to.
fromDir - the normal that determines the tilt at the bottom of the cylinder.
from - the start (bottom) position of the cylinder.
to - the end (top) position of the cylinder.
toDir - the normal that determines the tilt at the top of the cylinder.
radius - the radius of the cylinder.
sides - the number of sides the cylinder will have. It must have at least 3 sides.
capped - determines if a cap should be drawn at the top and at the bottom of the cyliner.

drawCone

public static void drawCone(GLAutoDrawable drawable,
                            Point3D tipp,
                            Point3D basee,
                            float radius,
                            int sides,
                            boolean capped)
Draws a cone.

Parameters:
drawable - the drawable that this drawing operations go to.
tipp - the tip of the cone.
basee - the base position of the cone.
radius - the radius of the base.
sides - the number of sides the cone will have. It must have at least 3 sides.
capped - determines if a cap should be drawn at the base of the cone.

project

public static Point3D project(Point3D p,
                              Vector3D dir,
                              Point3D origin,
                              Vector3D normal)
Projects a point p along the direction dir onto the plane that is defined by (origin,normal). The normal has to be of unit length.

Returns the projected point.