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