Ocean
rendering/Sphere.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_SPHERE_H
9 #define META_OCEAN_RENDERING_SPHERE_H
10 
12 #include "ocean/rendering/Shape.h"
13 
14 namespace Ocean
15 {
16 
17 namespace Rendering
18 {
19 
20 // Forward declaration
21 class Sphere;
22 
23 /**
24  * Definition of a smart object reference holding a sphere.
25  * @see SmartObjectRef, Sphere.
26  * @ingroup rendering
27  */
29 
30 /**
31  * This class is the base class for all spheres.<br>
32  * A default sphere has a radius of 1<br>
33  * @ingroup rendering
34  */
35 class OCEAN_RENDERING_EXPORT Sphere : virtual public Shape
36 {
37  public:
38 
39  /**
40  * Returns the radius of this sphere.
41  * @return Radius of the sphere
42  * @exception NotSupportedException Is thrown if this function is not supported
43  */
44  virtual Scalar radius() const;
45 
46  /**
47  * Sets the radius of this sphere.
48  * @param radius Radius to set
49  * @return True, if the specified radius was valid and could be set
50  * @exception NotSupportedException Is thrown if this function is not supported
51  */
52  virtual bool setRadius(const Scalar radius);
53 
54  /**
55  * Returns the type of this object.
56  * @see Object::type().
57  */
58  ObjectType type() const override;
59 
60  protected:
61 
62  /**
63  * Creates a new sphere object.
64  */
65  Sphere();
66 
67  /**
68  * Destructs a sphere object.
69  */
70  ~Sphere() override;
71 
72  /**
73  * Calculates the coordinate for given latitude and longitude values.
74  * The resulting position is for a sphere with radius 1.
75  * @param latitude The latitude value, in radian
76  * @param longitude The longitude value, in radian
77  * @return Resulting position on the sphere surface
78  */
79  static Vertex vertex(const Scalar latitude, const Scalar longitude);
80 };
81 
82 }
83 
84 }
85 
86 #endif // META_OCEAN_RENDERING_SPHERE_H
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all geometries.
Definition: rendering/Shape.h:35
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
This class is the base class for all spheres.
Definition: rendering/Sphere.h:36
~Sphere() override
Destructs a sphere object.
virtual bool setRadius(const Scalar radius)
Sets the radius of this sphere.
virtual Scalar radius() const
Returns the radius of this sphere.
Sphere()
Creates a new sphere object.
static Vertex vertex(const Scalar latitude, const Scalar longitude)
Calculates the coordinate for given latitude and longitude values.
ObjectType type() const override
Returns the type of this object.
float Scalar
Definition of a scalar type.
Definition: Math.h:128
SmartObjectRef< Sphere > SphereRef
Definition of a smart object reference holding a sphere.
Definition: rendering/Sphere.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15