-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathshapes.h
79 lines (71 loc) · 2.06 KB
/
shapes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Axis
// Changelog 02.02.24
#ifndef __Shapes__
#define __Shapes__
#include "vector.h"
// Axis class
class Axis
{
protected:
Vector a,b; //!< End vertices of the axis.
Vector axis; //!< Normalized axis vector.
double length; //!< Length of the axis.
double quadric[3]; //!< Quadric equation of the squared distance to the axis.
double linear[2]; //!< Linear equation of the distance along the axis.
public:
Axis(const Vector&,const Vector&);
};
// Cone class
class Cone:public Axis
{
protected:
double ra,rb,rrb,rra; //!< Radius of the cone at the end vertices of the axis.
double conelength; //!< Side length of the cone
Vector side; //!< Side vector of the cone.
public:
Cone(const Vector&,const Vector&,const double&,const double&);
double R(const Vector&) const;
void Set(const Vector&,const Vector&);
double R(const double&) const;
};
// Cone class
class SphereCone:public Axis
{
protected:
double ra,rb,rrb,rra; //!< Radius and squared radius values of the cone-sphere.
double ha,hb,hrb,hra; //!< Internal parameters of the cone joining the spheres.
double conelength; //!< Side length of the cone
Vector side; //!< Side vector of the cone.
public:
SphereCone(const Vector&,const Vector&,const double&,const double&);
double R(const Vector&) const;
void Set(const Vector&,const Vector&);
double R(const double&) const;
};
// Cylinder class
class Cylinder:public Axis
{
protected:
double r[2]; //!< Radius and squared radius.
Vector c; //!< Center.
double h; //!< Half length.
public:
Cylinder(const Vector&,const Vector&,const double&);
double R(const Vector&) const;
void Set(const Vector&,const Vector&);
double R(const double&) const;
};
// Cylinder class
class SphereCylinder:public Axis
{
protected:
double r[2]; //!< Radius and squared radius.
Vector c; //!< Center of the cylinder.
double h; //!< Half length.
public:
SphereCylinder(const Vector&,const Vector&,const double&);
double R(const Vector&) const;
void Set(const Vector&,const Vector&);
double R(const double&) const;
};
#endif