1. Drawing Splines on 3D. Java Version
A project by
Rodolfo Cartas Ayala
rodolfocartas@gmail.com
Submitted to
Dr. Raffaele de Amicis
January 8, 2007
2. User’s Manual
Execution
On Windows and Mac OS X double click the provided jar file. To launch from
console, type
java –jar curve2.jar
The application requires Java 1.5 and Java 3D 1.31 installed. It also requires the
colorchooser.jar and parallel_camera_parameters.jar files mapped in the system’s
classpath. Both files are included in the distribution.
The Toolbar
Navigation/ Parallel
Selection Copy Cut Perspective
Draw Delete Join Drawing
Plane
Navigation/Selection Button
When this mode is active, clicking on a curve will select it allowing further
modifications. Clicking on the canvas allows you to navigate the scene. Rotation,
zooming, and translation are done pressing different mouse buttons.
Left clicking rotates the scene.
Rotating the mouse wheel zooms in and out.
Right clicking translates the scene.
Draw Button
To draw, simply turn on this mode and click on the canvas. To finish drawing a
curve, double click at the termination point. The curve properties can be changed
using the properties panel.
3. Multiple selections can be done pressing the SHIFT key and clicking on each
curve.
Copy Button
In this mode a copy of a curve is creating when clicking on it.
Delete Button
In this mode a curve is deleted from the scene when clicked.
Cut Button
A curve can be cut clicking on two points belonging to it. The clicked point will be
shown.
Join Button
To join two curves with a hermite curve, click on the start and end of the curves to
join.
Parallel Perspective
When clicked the canvas will show the scene using parallel perspective.
Drawing plane
When active and in drawing mode, this will show a plane where curves are drawn.
The drawing plane can be modified using the following keys:
T Shows a perpendicular plane to the current one.
= Rotates the plane left.
- Rotates the plane right.
The Properties Panel
Curve Type
Thickness
Color
Curve Type
Five types of curves are provided: Hermite Spline, Four Point Spline, Bezier Spline,
Cubic B-Spline, and Cardinal Hermite Spline. The first two require four points to be
drawn. The rest can be drawn with at least two points and up to twenty points.
Thickness
Selects the thickness of the curve.
Color
Select the color of a curve.
4. Modifying Curves
Changing properties
To change the properties of a curve just select it and then use the properties panel
to change type, thickness, or color.
Translating
To rotate a curve first, select it and then right click on it. A contextual menu
appears, click on the translate option. A green bounding box appears. To translate,
keep pressed the mouse’s right button over the box and move it.
Rotating
To rotate a curve first, select it and then right click on it. A contextual menu
appears, click on the rotate option. A blue bounding box appears. To rotate, keep
pressed the mouse’s left button over the box and move it.
5. Scaling
To rotate a curve first, select it and then right click on it. A contextual menu
appears, click on the translate option. A dialog appears, enter the scaling factor and
click ok.
Grouping
To group a set of curve, multiple select them and then go to Selection>Grouping.
When clicking on any of the curve a white box containing the curves will appear.
Translation, Rotation, and Scaling can be applied to the group. To ungroup, select
the group, and then go to Selection>Ungroup.
Saving and opening scenes
Use the Open and Save options of the File Menu to save the scene to a file. Files are
written in XML.
6. System Model
Main Classes
The following class diagram shows the core classes in the system. User input and
scene graph management.
DrawingFrame: A Swing component used to capture the mouse wheel
events.
CurvesCanvas: Class inheriting from Canvas3D. This class manages the
scene graph.
Control: This class bridges widget events to the drawing subsystem through
the Canvas.
DrawingBehavior: Processes events to draw curves. It then creates
CurveGroups that contain a Spline, the generalization of a Curve. This
CurveGroups are added to the scene graph.
7. Spline Subsystem
The Spline abstract class implements functionality to manage geometries and
callbacks to the Behavior Subsystem through the
GraphicalSelectableObjectInterface. All classes inheriting from Spline must
implement the calculation of points and other special functions such as cutting or
derivative calculation.
The CurveGroup inherits from BranchGroup and is used to store a Spline and
behaviors that modify the Spline appeareance.
Behavior Subsystem
CurvesPickBehavior accepts mouse events and picks the objects clicked.
CurveClickerBehavior stores the last object clicked.
DrawingBehavior gets the mouse event and creates Splines.
JoinBehavior and CutBehavior use the object stores by their parent to implement
curve joining and cutting.
KeyboardBehavior process key presses to modify the drawing plane.
ModeConstants is used to store constants for DrawingBehavior.