blob: 69c78082aa1c005d6049fe75336e3076f0115fc5 (
plain)
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
|
package tesseract.objects.blimp;
import java.awt.Color;
import javax.media.j3d.Appearance;
import javax.media.j3d.Geometry;
import javax.media.j3d.Material;
import javax.media.j3d.Node;
import javax.media.j3d.Shape3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3f;
import tesseract.objects.PhysicalObject;
import com.sun.j3d.utils.geometry.Box;
import com.sun.j3d.utils.geometry.Primitive;
public class BlimpBox extends PhysicalObject {
/**
* The appearance of this blimp box
*/
private Appearance my_appearance;
/**
* The width.
*/
private float my_width;
/**
* The height.
*/
private float my_height;
/**
* The depth.
*/
private float my_depth;
/**
* The box for the blimp
*/
private Primitive my_box;
/**
* The tg for this object
*/
private TransformGroup my_tg;
public BlimpBox(float mass, float width, float height, float depth,
Vector3f position, final Appearance app) {
super(position, mass);
my_width = width;
my_height = height;
my_depth = depth;
my_appearance = app;
setShape(createShape());
previousPosition.set(position);
/*if (inverseMass != 0) {
inverseInertiaTensor.m00 = 1f / 12 / inverseMass * (height * height + depth * depth);
inverseInertiaTensor.m11 = 1f / 12 / inverseMass * (width * width + depth * depth);
inverseInertiaTensor.m22 = 1f / 12 / inverseMass * (width * width + height * height);
inverseInertiaTensor.invert();
}*/
updateTransformGroup();
}
public Node createShape() {
Primitive box = new com.sun.j3d.utils.geometry.Box(my_width / 2, my_height / 2, my_depth / 2, my_appearance);
my_box = box;
return box;
}
/**
* Return the box shape to be used to get the front based on Phil's idea to get front
*/
public Primitive getBoxShape() {
return my_box;
}
/**
* get the tg for this box
*/
public Node getTG() {
return my_tg;
}
}
|