From 21ac57b36a9e3b909853c7d64ac29b7ad72490a3 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 02 Sep 2019 16:52:19 -0400
Subject: [PATCH] Figure panel.

---
 cMesh.java |  118 ++++++-----------------------------------------------------
 1 files changed, 12 insertions(+), 106 deletions(-)

diff --git a/cMesh.java b/cMesh.java
index c2eb4ad..51a76c3 100644
--- a/cMesh.java
+++ b/cMesh.java
@@ -1,6 +1,6 @@
 import java.util.Hashtable;
 
-import javax.media.opengl.GL;
+//import javax.media.opengl.GL;
 
 public class cMesh extends cSpring
 {
@@ -49,7 +49,7 @@
     
     cMesh(Object3D bRep)
     {
-        this("Me:" + bRep.name, bRep);
+        this("Mesh:" + bRep.name, bRep);
     }
     
     cMesh(String name, Object3D bRep)
@@ -78,7 +78,7 @@
             
             live = true;
     }
-    
+
     Object3D deepCopy()
     {
         /*
@@ -404,8 +404,8 @@
         if (ref == null)
             return;
         
-        GrafreeD.epsequal = IsEpsEqual();
-        GrafreeD.linkUV = IsLinkUV();
+        Grafreed.epsequal = IsEpsEqual();
+        Grafreed.linkUV = IsLinkUV();
         
 //        BoundaryRep oldrep = transientrep;
         
@@ -419,7 +419,7 @@
         Object3D obj = ref.GetObject();
         
         // may 2014: side-effect with UVs!!
-        obj = (Object3D) GrafreeD.clone(obj);
+        obj = (Object3D) Grafreed.clone(obj);
         
         merge(obj);
 
@@ -429,7 +429,7 @@
         bRep.Trim(false, false,false,false,false);
             System.out.println("------> TRIM " + ref + "; #vertices = " + bRep.VertexCount() + "; #faces = " + bRep.FaceCount());
 
-        GrafreeD.epsequal = false;
+        Grafreed.epsequal = false;
 
         if (transientrep != null && bRep.VertexCount() == transientrep.VertexCount())
         {
@@ -470,7 +470,7 @@
         }
         else
             // geometry is merged...
-            refcopy = (BoundaryRep) GrafreeD.clone(transientrep);
+            refcopy = (BoundaryRep) Grafreed.clone(transientrep);
     }
     
     transient cVector minima = new cVector();
@@ -484,7 +484,7 @@
     }
     
     
-    void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ??
+    void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) // ??
     {
 // ??????        if (size() > 0)
 //        {
@@ -545,103 +545,7 @@
         
         if(/*showsprings &&*/ Phys != null)
         {
-            GL gl = display.GetGL(); // getGL();
-
-            gl.glDisable(gl.GL_LIGHTING);
-            
-            gl.glLineWidth(1);
-            gl.glColor3f(1,1,1);
-            gl.glBegin(gl.GL_LINES);
-            double scale = 0;
-            int count = 0;
-            for (int s=0; s<Phys.allSprings.size(); s++)
-            {
-                Spring spring = Phys.allSprings.get(s);
-                    if(s == 0)
-                    {
-                        //System.out.println(" spring : " + spring.a.position + "; " + spring.b.position);
-                    }
-            if (showsprings)
-            {
-                temp.set(spring.a.position);
-                temp.add(spring.b.position);
-                temp.mul(0.5);
-                temp2.set(spring.a.position);
-                temp2.sub(spring.b.position);
-                temp2.mul(spring.restLength/2);
-                temp.sub(temp2);
-                gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z);
-                temp.add(temp2);
-                temp.add(temp2);
-                gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z);
-            }
-
-                if (spring.isHandle)
-                    continue;
-                
-                //if (scale < spring.restLength)
-                    scale += spring.restLength;
-                    count++;
-            }
-            gl.glEnd();
-
-            if (count == 0)
-                scale = 0.01;
-            else
-                scale /= count * 3;
-            
-            //scale = 0.25;
-            
-            if (ShowInfo())
-            {
-                gl.glLineWidth(4);
-                for (int s=0; s<Phys.allNodes.size(); s++)
-                {
-                    DynamicNode node = Phys.allNodes.get(s);
-                    if (node.mass == 0)
-                        continue;
-                    
-                    int i = node.springs==null?-1:node.springs.size();
-                    gl.glColor3f((i>>2)&1,(i>>1)&1,i&1);
-                    //temp.set(node.springForce.x, node.springForce.y, node.springForce.z);
-                    //temp.normalize();
-                    //gl.glColor3d((temp.x+1)/2, (temp.y+1)/2, (temp.z+1)/2);
-                    gl.glBegin(gl.GL_LINES);
-                    gl.glVertex3d(node.position.x, node.position.y, node.position.z);
-                    //gl.glVertex3d(node.position.x + node.normal.x*scale, node.position.y + node.normal.y*scale, node.position.z + node.normal.z*scale);
-                    gl.glVertex3d(node.position.x + bRep.GetVertex(s).norm.x*scale,
-                            node.position.y + bRep.GetVertex(s).norm.y*scale,
-                            node.position.z + bRep.GetVertex(s).norm.z*scale);
-                    gl.glEnd();
-                }
-
-                gl.glLineWidth(8);
-                for (int s=0; s<Phys.allNodes.size(); s++)
-                {
-                    DynamicNode node = Phys.allNodes.get(s);
-
-                    if (node.springs != null)
-                    {
-                        for (int i=0; i<node.springs.size(); i+=1)
-                        {
-                            DynamicNode f = node.springs.get(i).GetOther(node);
-                            
-                            int c = i+1;
-                       //     c = node.springs.get(i).nbcopies;
-
-                            gl.glColor3f((c>>2)&1,(c>>1)&1,c&1);
-                            gl.glBegin(gl.GL_LINES);
-                                gl.glVertex3d(node.position.x, node.position.y, node.position.z);
-                                gl.glVertex3d(f.position.x/3+node.position.x*2/3, f.position.y/3+node.position.y*2/3, f.position.z/3+node.position.z*2/3);
-                            gl.glEnd();
-                        }
-                    }
-                }
-
-                gl.glLineWidth(1);
-            }
-            
-            gl.glEnable(gl.GL_LIGHTING);
+            display.DrawDynamicMesh(this);
         }
         
         if (live && Globals.isLIVE() && display.DrawMode() == CameraPane.DEFAULT)
@@ -656,6 +560,8 @@
                 maxima = new cVector();
             }
             
+            CameraPane.CreateSelectedPoint();
+            
 //            ref.getBounds(minima, maxima, true);
 //            Phys.reference.set((maxima.x+minima.x)/2,(maxima.y+minima.y)/2,(maxima.z+minima.z)/2);
             //ref.

--
Gitblit v1.6.2