[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob org/nongnu/libvob/vobs/PinStub.java incl...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] libvob org/nongnu/libvob/vobs/PinStub.java incl... |
Date: |
Fri, 11 Apr 2003 08:45:42 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Asko Soukka <address@hidden> 03/04/11 08:45:42
Modified files:
org/nongnu/libvob/vobs: PinStub.java
include/vob/vobs: Trivial.hxx
Log message:
doc
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/vobs/PinStub.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.14
libvob/include/vob/vobs/Trivial.hxx:1.15
--- libvob/include/vob/vobs/Trivial.hxx:1.14 Tue Apr 8 15:44:00 2003
+++ libvob/include/vob/vobs/Trivial.hxx Fri Apr 11 08:45:42 2003
@@ -86,20 +86,26 @@
Pt box0 = t0.getSqSize();
Pt box1 = t1.getSqSize();
+ /** Transforms points through given transformations. */
ZPt pt0 = t0.transform(ZPt(box0.x*px0, box0.y*py0, 0));
ZPt pt1 = t1.transform(ZPt(box1.x*px1, box1.y*py1, 0));
+ /** The distance between transformed points. */
float len = sqrt(pow(pt1.x-pt0.x, 2)
+ pow(pt1.y-pt0.y, 2));
- float dx, dy;
- dx = (int)(((1-factor)*len*pt0.x + (factor)*len*pt1.x)/len);
- dy = (int)(((1-factor)*len*pt0.y + (factor)*len*pt1.y)/len);
+
+ /** The end coordinates of PinStub. The length of pin is
+ * the distance between transformed point in factor f.
+ */
+ float dx = (int)(((1-factor)*len*pt0.x + (factor)*len*pt1.x)/len);
+ float dy = (int)(((1-factor)*len*pt0.y + (factor)*len*pt1.y)/len);
glBegin(GL_LINES);
glVertex3f(pt0.x, pt0.y, 0);
glVertex3f(dx, dy, 0);
glEnd();
+ /** Render small circle as pin's ball. */
glBegin(GL_POLYGON);
for (double i=0; i<360; i+=36) {
float a = (float)((M_PI / 180) * (360-i));
Index: libvob/org/nongnu/libvob/vobs/PinStub.java
diff -u libvob/org/nongnu/libvob/vobs/PinStub.java:1.3
libvob/org/nongnu/libvob/vobs/PinStub.java:1.4
--- libvob/org/nongnu/libvob/vobs/PinStub.java:1.3 Fri Apr 11 08:17:35 2003
+++ libvob/org/nongnu/libvob/vobs/PinStub.java Fri Apr 11 08:45:42 2003
@@ -33,21 +33,31 @@
/**Pin like Stub vob for marking hidden connections. */
public class PinStub extends AbstractVob {
-public static final String rcsid = "$Id: PinStub.java,v 1.3 2003/04/11
12:17:35 humppake Exp $";
+public static final String rcsid = "$Id: PinStub.java,v 1.4 2003/04/11
12:45:42 humppake Exp $";
+ /** Pin's start and end coordinates. */
private float x0, y0, x1, y1;
+
+ /** Pin's drawing color. */
private Color color;
+
+ /** Points to hold coordinates after transformations. */
private Point pt0, pt1;
- /** pin's length factor */
+ /** Pin's stick's length factor. The length is relative to
+ * the distance of vobs coordinates after coordinate system
+ * transformations.
+ */
private float f;
- /** pin's radius */
+ /** Pin's radius. */
private float r;
- /**
- * @param x0, y0 Coordinate inside first coord system
- * @param x1, y1 Coordinate inside second coord system
+ /** Pin like stub
+ * @param x0 X-coordinate before first CS transformation.
+ * @param y0 Y-cordinate before first CS transformation.
+ * @param x1 X-coordinate before second CS transformation.
+ * @param y1 Y-coordinate before second CS transformation.
* @param color Drawing color.
* @param f Pin's stick's length factor.
* @param r Pin's radius.
@@ -75,20 +85,25 @@
}
public void render(Graphics g,
- boolean fast,
- Vob.RenderInfo info1,
- Vob.RenderInfo info2) {
+ boolean fast,
+ Vob.RenderInfo info1,
+ Vob.RenderInfo info2) {
if(fast) return;
if(color != null) g.setColor(color);
+ /** Transforms points through given transformations. */
info1.xform(x0, y0, pt0);
info2.xform(x1, y1, pt1);
- int dx, dy;
+ /** The distance between transformed points. */
double len = Math.sqrt(Math.pow(pt1.x-pt0.x, 2)
+ Math.pow(pt1.y-pt0.y, 2));
- dx = (int)(((1-f)*len*pt0.x + (f)*len*pt1.x)/len);
- dy = (int)(((1-f)*len*pt0.y + (f)*len*pt1.y)/len);
+
+ /** The end coordinates of PinStub. The length of pin is
+ * the distance between transformed point in factor f.
+ */
+ int dx = (int)(((1-f)*len*pt0.x + (f)*len*pt1.x)/len);
+ int dy = (int)(((1-f)*len*pt0.y + (f)*len*pt1.y)/len);
g.drawLine(pt0.x, pt0.y, dx, dy);
g.fillOval((int)(dx-r), (int)(dy-r), (int)(r*2), (int)(r*2));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob org/nongnu/libvob/vobs/PinStub.java incl...,
Asko Soukka <=