diff --git a/geotypes.cpp b/geotypes.cpp index 26451a0..bb08484 100644 --- a/geotypes.cpp +++ b/geotypes.cpp @@ -75,6 +75,11 @@ void Ray::set(Punkt3D _pos, Punkt3D _dir) { dir = _dir; } +void Ray::setFromPoints(Punkt3D a, Punkt3D b) { + pos = a; + dir = b - a; +} + Punkt3D Ray::get(float x) { return pos + dir*x; } diff --git a/geotypes.h b/geotypes.h index 555e028..a00d275 100644 --- a/geotypes.h +++ b/geotypes.h @@ -60,6 +60,7 @@ class Ray { Ray(Punkt3D _pos, Punkt3D _dir); void set(Punkt3D _pos, Punkt3D _dir); + void setFromPoints(Punkt3D a, Punkt3D b); Punkt3D get(float x); bool onRay(Punkt3D p, int rnd=-1); float dist(Punkt3D p);