3es  0.7
3esstar.h
1 //
2 // author: Kazys Stepanas
3 //
4 #ifndef _3ESSTAR_H_
5 #define _3ESSTAR_H_
6 
7 #include "3es-core.h"
8 #include "3esshape.h"
9 
10 namespace tes
11 {
20  class _3es_coreAPI Star : public Shape
21  {
22  public:
23  Star(uint32_t id = 0u, const V3Arg &centre = V3Arg(0, 0, 0), float radius = 1.0f);
29  Star(uint32_t id, uint16_t category, const V3Arg &centre = V3Arg(0, 0, 0), float radius = 1.0f);
30 
34  Star &setRadius(float radius);
37  float radius() const;
38 
42  Star &setCentre(const V3Arg &centre);
45  Vector3f centre() const;
46  };
47 
48 
49  inline Star::Star(uint32_t id, const V3Arg &centre, float radius)
50  : Shape(SIdStar, id)
51  {
52  setPosition(centre);
53  setScale(Vector3f(radius));
54  }
55 
56 
57  inline Star::Star(uint32_t id, uint16_t category, const V3Arg &centre, float radius)
58  : Shape(SIdStar, id, category)
59  {
60  setPosition(centre);
61  setScale(Vector3f(radius));
62  }
63 
64 
65  inline Star &Star::setRadius(float radius)
66  {
67  setScale(Vector3f(radius));
68  return *this;
69  }
70 
71 
72  inline float Star::radius() const
73  {
74  return scale().x;
75  }
76 
77 
78  inline Star &Star::setCentre(const V3Arg &centre)
79  {
80  setPosition(centre);
81  return *this;
82  }
83 
84 
85  inline Vector3f Star::centre() const
86  {
87  return position();
88  }
89 }
90 
91 #endif // _3ESSTAR_H_
A base class for encapsulating a shape which is to be represented remotely.
Definition: 3esshape.h:39
float radius() const
Get the star radial extents.
Definition: 3esstar.h:72
Defines a star to display.
Definition: 3esstar.h:20
Star & setRadius(float radius)
Set the star radial extents.
Definition: 3esstar.h:65
Star & setCentre(const V3Arg &centre)
Set the star centre coordinate.
Definition: 3esstar.h:78
Definition: 3esbounds.h:13
Vector3< float > Vector3f
Defines a single precision vector.
Definition: 3esvector3.h:14
Represents a vector in R3.
Definition: 3esvector3.h:14
A helper structure used to convert from float or double pointers to Vector3f arguments.
Definition: 3esv3arg.h:14
Vector3f centre() const
Get the star centre coordinate.
Definition: 3esstar.h:85
T x
Direct data member access.
Definition: 3esvector3.h:30