GeoObjects.h
00001
00002
00003
00004
00005 #pragma once
00006
00007 #include "Geo.h"
00008
00009 namespace GEO
00010 {
00011
00012
00013
00014 struct Line
00015 {
00016 Vector3 pos;
00017 Vector3 dir;
00018
00019
00020 inline Line() {}
00021 inline Line(const Vector3 &inPos, const Vector3 &inDir)
00022 { pos=inPos; dir=inDir; }
00023 };
00024
00025
00026 struct Plane
00027 {
00028 float c0,c1,c2,c3;
00029
00030
00031 inline Plane() {}
00032
00033 inline Plane(const Vector3 &inPos, const Vector3 &inNormal)
00034 {
00035 Normal()=inNormal;
00036 Renormalize();
00037 c3=-VecDot(inPos,Normal());
00038 }
00039
00040 inline Plane(float inC0,float inC1,float inC2,float inC3): c0(inC0), c1(inC1), c2(inC2), c3(inC3)
00041 { Renormalize(); }
00042
00043
00044 inline Vector3& Normal() const { return *((Vector3*)this); }
00045
00046
00047 inline void Renormalize() { Normal().Normalize(); }
00048 };
00049
00050
00051 struct Sphere
00052 {
00053 Vector3 pos;
00054 float radius;
00055
00056
00057 inline Sphere() {}
00058 inline Sphere(const Vector3 &p, float r)
00059 { pos=p; radius=r; }
00060 };
00061
00062
00063 struct AARectoid
00064 {
00065 Vector3 center;
00066 float xradius;
00067 float yradius;
00068 float zradius;
00069
00070
00071 inline AARectoid() {}
00072 inline AARectoid(Vector3 c, float x, float y, float z)
00073 { center=c; xradius=x; yradius=y; zradius=z; }
00074 };
00075
00076
00077 struct XAlignedUnboundedCylinder: Line
00078 {
00079 float y;
00080 float z;
00081 float radius;
00082
00083
00084 inline XAlignedUnboundedCylinder() {}
00085 inline XAlignedUnboundedCylinder(float ypos, float zpos, float rad)
00086 { y=ypos; z=zpos; radius=rad; }
00087 };
00088
00089
00090 struct YAlignedEllipsoid: Sphere
00091 {
00092 float ymultiplier;
00093
00094
00095 inline YAlignedEllipsoid() {}
00096 inline YAlignedEllipsoid(const Vector3 &p, float r, float ymod)
00097 { pos=p; radius=r; ymultiplier=ymod; }
00098 };
00099
00100
00101
00102
00103 struct Circle
00104 {
00105 Vector2 pos;
00106 float radius;
00107
00108 inline Circle() {}
00109 inline Circle(GEO::Vector2 position, float rad)
00110 { pos=position; radius=rad; }
00111 };
00112
00113
00114 struct AxisAlignedEllipse
00115 {
00116 Vector2 pos;
00117 float radius;
00118 float xmod;
00119 float ymod;
00120
00121 inline AxisAlignedEllipse() {}
00122 inline AxisAlignedEllipse(Vector2 position, float rad, float xax, float yax)
00123 { pos=position; radius=rad; xmod=xax; ymod=yax; }
00124 };
00125
00126 };