Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13937/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
Protractor.java RotationTool.java
Log Message:
Protractor improvement
Index: Protractor.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Protractor.java 15 Nov 2007 10:41:52 -0000 1.11
--- Protractor.java 15 Nov 2007 12:21:43 -0000 1.12
***************
*** 95,99 ****
edges.add(line);
feedback(edges);
! protract = new Protract(start.vertex(), i, j);
glv.getView().addGlObjects3D(protract);
} else {
--- 95,99 ----
edges.add(line);
feedback(edges);
! protract = new Protract(start.vertex(), i, j, true);
glv.getView().addGlObjects3D(protract);
} else {
***************
*** 109,113 ****
Vertex i = system.getI();
Vertex j = system.getJ();
! protract = new Protract(current.vertex(), i, j);
glv.getView().addGlObjects3D(protract);
}
--- 109,113 ----
Vertex i = system.getI();
Vertex j = system.getJ();
! protract = new Protract(current.vertex(), i, j, false);
glv.getView().addGlObjects3D(protract);
}
***************
*** 219,222 ****
--- 219,223 ----
private Vertex u;
private Vertex v;
+ private boolean hitable;
/**
***************
*** 225,233 ****
* @param i Vertex
* @param j Vertex
*/
! public Protract(Vertex origin, Vertex i, Vertex j) {
this.origin = origin;
this.u = i;
this.v = j;
}
--- 226,236 ----
* @param i Vertex
* @param j Vertex
+ * @param hitable hitable
*/
! public Protract(Vertex origin, Vertex i, Vertex j, boolean hitable) {
this.origin = origin;
this.u = i;
this.v = j;
+ this.hitable = hitable;
}
***************
*** 241,244 ****
--- 244,259 ----
/** {@inheritDoc} */
public void draw(GL gl) {
+ drawNormal(gl);
+ }
+
+ /** {@inheritDoc} */
+ public Intersection intersection(Edge e) {
+ Vertex n = u.cross(v);
+ Plane plane = new Plane(n, origin);
+ Vertex vertex = plane.intersection(e);
+ return new Intersection(vertex, Intersection.PLANE_INTERSECTION, plane);
+ }
+
+ private void drawNormal(GL gl) {
Camera camera = Project.getInstance().getCurrentCamera();
double distance = camera.distance(origin);
***************
*** 275,280 ****
{
gl.glBegin(GL.GL_LINES);
! for (int i = 0; i < 36; i++) {
! double angle = 2 * Math.PI * i / 36;
Vertex p = radian(radius, angle);
Vertex q = radian(radius * 0.95, angle);
--- 290,295 ----
{
gl.glBegin(GL.GL_LINES);
! for (int i = 0; i < 24; i++) {
! double angle = 2 * Math.PI * i / 24;
Vertex p = radian(radius, angle);
Vertex q = radian(radius * 0.95, angle);
***************
*** 285,295 ****
}
}
/** {@inheritDoc} */
! public Intersection intersection(Edge e) {
! Vertex n = u.cross(v);
! Plane plane = new Plane(n, origin);
! Vertex vertex = plane.intersection(e);
! return new Intersection(vertex, Intersection.PLANE_INTERSECTION, plane);
}
}
--- 300,322 ----
}
}
+ private void drawSelect(GL gl) {
+ Camera camera = Project.getInstance().getCurrentCamera();
+ double distance = camera.distance(origin);
+ double radius = 3 * distance;
+ double n = 36;
+ gl.glBegin(GL.GL_POLYGON);
+ for (int i = 0; i < n; i++) {
+ double angle = 2 * Math.PI * i / n;
+ Vertex p = radian(radius, angle);
+ gl.glVertex3d(p.getX(), p.getY(), p.getZ());
+ }
+ gl.glEnd();
+ }
/** {@inheritDoc} */
! public void select(GL gl) {
! if (hitable) {
! drawSelect(gl);
! }
}
}
Index: RotationTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** RotationTool.java 15 Nov 2007 10:41:52 -0000 1.28
--- RotationTool.java 15 Nov 2007 12:21:43 -0000 1.29
***************
*** 386,389 ****
--- 386,394 ----
}
+ /** {@inheritDoc} */
+ public void select(GL gl) {
+ draw(gl);
+ }
+
/**
* @inheritDoc
|