Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SbSphere.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef _SB_SPHERE_
24#define _SB_SPHERE_
25
26#include <Inventor/SbVec.h>
27
28class SbLine;
29class SbBox3f;
30
32//
33// Class: SbSphere
34//
35// Represents a sphere in 3D space.
36//
38
39
57class SbSphere {
58public:
59
64
68 SbSphere(const SbVec3f &c, float r);
69
73 void setValue(const SbVec3f &c, float r);
74
78 void setCenter(const SbVec3f &c);
82 void setRadius(float r);
83
87 const SbVec3f &getCenter() const { return center; }
91 float getRadius() const { return radius; }
92
96 void circumscribe(const SbBox3f &box);
97
103 SbBool intersect(const SbLine &l, SbVec3f &intersection) const;
108 SbBool intersect(const SbLine &l, SbVec3f &enter, SbVec3f &exit) const;
109
110private:
111 SbVec3f center;
112 float radius;
113
114};
115
116#endif /* _SB_SPHERE_ */
117
118
SbBool enter(uintptr_t key, void *value)
3D box class.
Definition SbBox.h:649
Directed line in 3D.
Definition SbLine.h:57
Class for representing a sphere.
Definition SbSphere.h:57
void setRadius(float r)
Set the radius.
SbSphere()
Default constructor.
Definition SbSphere.h:63
void circumscribe(const SbBox3f &box)
Return a sphere containing a given box.
void setValue(const SbVec3f &c, float r)
Change the center and radius.
void setCenter(const SbVec3f &c)
Set the center.
SbSphere(const SbVec3f &c, float r)
Constructor that takes a center and a radius.
float getRadius() const
Return the radius.
Definition SbSphere.h:91
SbBool intersect(const SbLine &l, SbVec3f &intersection) const
Intersect line and sphere, returning TRUE if there is an intersection.
SbBool intersect(const SbLine &l, SbVec3f &enter, SbVec3f &exit) const
Intersect line and sphere, returning TRUE if there is an intersection.
const SbVec3f & getCenter() const
Return the center.
Definition SbSphere.h:87
3D vector class.
Definition SbVec.h:932
int SbBool
Boolean type.
Definition SbBase.h:87