From a9b6ce300005e69d1440ee2fb29022d3facd4efc Mon Sep 17 00:00:00 2001 From: seba Date: Fri, 18 Sep 2009 14:30:40 +0200 Subject: [PATCH] Added func to Ray --- geotypes.cpp | 5 +++++ geotypes.h | 1 + 2 files changed, 6 insertions(+) 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);