Browse Source

Added func to Ray

seba 11 years ago
parent
commit
a9b6ce3000
2 changed files with 6 additions and 0 deletions
  1. 5
    0
      geotypes.cpp
  2. 1
    0
      geotypes.h

+ 5
- 0
geotypes.cpp View File

@@ -75,6 +75,11 @@ void Ray::set(Punkt3D _pos, Punkt3D _dir) {
75 75
 	dir = _dir;
76 76
 }
77 77
 
78
+void Ray::setFromPoints(Punkt3D a, Punkt3D b) {
79
+	pos = a;
80
+	dir = b - a;
81
+}
82
+
78 83
 Punkt3D Ray::get(float x) {
79 84
 	return pos + dir*x;
80 85
 }

+ 1
- 0
geotypes.h View File

@@ -60,6 +60,7 @@ class Ray {
60 60
 		Ray(Punkt3D _pos, Punkt3D _dir);
61 61
 		
62 62
 		void set(Punkt3D _pos, Punkt3D _dir);
63
+		void setFromPoints(Punkt3D a, Punkt3D b);
63 64
 		Punkt3D get(float x);
64 65
 		bool onRay(Punkt3D p, int rnd=-1);
65 66
 		float dist(Punkt3D p);

Loading…
Cancel
Save