Normand Briere
2019-11-21 ddb10cb84dddfeef1ef9946f2e13cef3c93e6cc4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import javax.media.opengl.GL;
import java.util.Hashtable;
 
/**
 *
 * @author nbriere
 */
public class PointFlow extends Object3D
{
    static final long serialVersionUID = 0;
    
    cList<cVector> points = new cList();
    
    transient Hashtable<cVector, cVector> ht;
    
    PointFlow()
    {
        super("Flow");
        
        CreateMaterial();
        
        live = true;
    }
    
    void CreateHT()
    {
        if (ht == null)
        {
            ht = new Hashtable();
            
            cList<cVector> newpoints = new cList();
    
            for (int i=0; i<points.size(); i++)
            {
                cVector w = points.get(i);
                
                if (ht.get(w) != null)
                    continue;
                
                newpoints.add(w);
                ht.put(w, w);
            }
            
            points = newpoints;
        }
    }
    
    void add(cVector v)
    {
        if (!live)
            return;
        
        CreateHT();
        
        if (ht.get(v) != null)
            return;
        
//        if (points.size() > 0 && points.get(points.size()-1).equals(v))
//            return;
        
        System.err.println("new point = " + v);
        points.add(v);
        ht.put(v,v);
    }
    
//    void add(double x, double y, double z)
//    {
//        points.add(new cVector(x,y,z));
//    }
    
    void Reset()
    {
        if (points.size() > 0)
        {
            cVector v = points.get(0);
            
            CameraPane.selectedpoint.toParent[3][0] = v.x;
            CameraPane.selectedpoint.toParent[3][1] = v.y;
            CameraPane.selectedpoint.toParent[3][2] = v.z;
        }
        
        points.clear();
        ht.clear();
    }
    
    static Sphere geo = new Sphere();
    
    static
    {
        geo.material = null;
        geo.bRep.Stripify();
        geo.bRep.colors = null;
    }
    
    float[] texmat = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
    
    double minimumSize = 0, maximumSize = 0.01;
    double resizefactor = 1;
    
    static cVector tmp = new cVector();
        
    void createEditWindow(GroupEditor callee, boolean newWindow)
    {
        //editWindow = (new SphereEditor(this, deepCopy(), callee)).GetEditor();
        if (newWindow)
        {
            objectUI = new PointFlowEditor(this, deepCopy(), callee);
        } else
        {
            objectUI = new PointFlowEditor(this, callee);
        }
        editWindow = objectUI.GetEditor();
    }
}