1 | package com.framsticks.model; |
---|
2 | |
---|
3 | import com.framsticks.params.annotations.ParamAnnotation; |
---|
4 | import com.framsticks.util.math.Orientation; |
---|
5 | import com.framsticks.util.math.Point3d; |
---|
6 | |
---|
7 | /** |
---|
8 | * Author: Piotr Śniegowski |
---|
9 | */ |
---|
10 | public class BasePart { |
---|
11 | |
---|
12 | @ParamAnnotation |
---|
13 | public double x, y, z; |
---|
14 | |
---|
15 | public Point3d getPosition() { return new Point3d(x, y, z); } |
---|
16 | public void setPosition(Point3d p) { x = p.x; y = p.y; z = p.z; } |
---|
17 | |
---|
18 | @ParamAnnotation(id = "m", stringType = "f 0.1 999.0 1.0") |
---|
19 | public double mass = 1.0; |
---|
20 | |
---|
21 | @ParamAnnotation(id = "s") |
---|
22 | public double size = 0.0; |
---|
23 | |
---|
24 | @ParamAnnotation(id = "fr") |
---|
25 | public double friction; |
---|
26 | |
---|
27 | @ParamAnnotation |
---|
28 | public double oxx, oxy, oxz, oyx, oyy, oyz, ozx, ozy, ozz; |
---|
29 | |
---|
30 | public Orientation getOrientation() { return new Orientation(new Point3d(oxx, oxy, oxz), new Point3d(oyx, oyy, oyz), new Point3d(ozx, ozy, ozz)); } |
---|
31 | |
---|
32 | public void setOrientation(Orientation o) { |
---|
33 | oxx = o.x.x; |
---|
34 | oxy = o.x.y; |
---|
35 | oxz = o.x.z; |
---|
36 | oyx = o.y.x; |
---|
37 | oyy = o.y.y; |
---|
38 | oyz = o.y.z; |
---|
39 | ozx = o.z.x; |
---|
40 | ozy = o.z.y; |
---|
41 | ozz = o.z.z; |
---|
42 | } |
---|
43 | |
---|
44 | public void copyFrom(BasePart p) { |
---|
45 | setPosition(p.getPosition()); |
---|
46 | setOrientation(p.getOrientation()); |
---|
47 | mass = p.mass; |
---|
48 | size = p.size; |
---|
49 | friction = p.friction; |
---|
50 | } |
---|
51 | } |
---|