source: java/main/src/main/java/com/framsticks/model/BasePart.java @ 193

Last change on this file since 193 was 193, checked in by Maciej Komosinski, 10 years ago

Set svn:eol-style native for all textual files

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1package com.framsticks.model;
2
3import com.framsticks.params.annotations.ParamAnnotation;
4import com.framsticks.util.math.Orientation;
5import com.framsticks.util.math.Point3d;
6
7/**
8 * Author: Piotr Śniegowski
9 */
10public 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}
Note: See TracBrowser for help on using the repository browser.