Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

84 righe
1.5 KiB

#ifndef __GEOTYPES_H
#define __GEOTYPES_H
#include "punkt3d.h"
namespace segl {
class Ray;
class Box;
class Plane;
class Sphere {
public:
Punkt3D pos;
float radius;
Sphere(Punkt3D _pos, float radius);
Sphere();
bool collision(const Sphere &s) const;
bool collision(const Ray &r) const;
bool collision(const Box & b) const;
bool collision(const Plane &p) const;
bool inSphere(Punkt3D p) const;
Punkt3D getPos() const;
};
class Ray {
public:
Punkt3D pos;
Punkt3D dir;
Ray();
Ray(Punkt3D _pos, Punkt3D _dir);
void set(Punkt3D _pos, Punkt3D _dir);
Punkt3D get(float x);
bool onRay(Punkt3D p, int rnd=-1);
float dist(Punkt3D p);
float getParam(Punkt3D p, bool onray=false);
bool collision(const Sphere &s) const;
bool collision(const Ray &r) const;
bool collision(const Box & b) const;
bool collision(const Plane &p) const;
};
class Box {
public:
Punkt3D min;
Punkt3D max;
Box();
Box(Punkt3D _min, Punkt3D _max);
bool collision(const Sphere &s) const;
bool collision(const Ray &r) const;
bool collision(const Box & b) const;
bool collision(const Plane &p) const;
};
class Plane {
public:
Punkt3D pos;
Punkt3D norm;
Plane();
Plane(Punkt3D _pos, Punkt3D _norm);
Plane(float x, float y, float z, float a);
bool collision(const Sphere &s) const;
bool collision(const Ray &r) const;
bool collision(const Box & b) const;
bool collision(const Plane &p) const;
float dist(Punkt3D p) const;
};
} // namespace segl
#endif