---
name: "SbSphere"
section: "3iv"
platform: "linux"
package: "inventor-doc"
version: "2.1.6+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SbSphere/3iv"
---

# SbSphere(3iv)

class for representing a sphere

## NAME

SbSphere — class for representing a sphere

## INHERITS FROM

SbSphere

## SYNOPSIS

**#include \<Inventor/SbLinear.h\>**

Methods from class SbSphere:

	**SbSphere()**\
 	**SbSphere(const SbVec3f &center, float radius)**\
 **void**	**setValue(const SbVec3f &center, float radius)**\
 **void**	**setCenter(const SbVec3f &center)**\
 **void**	**setRadius(float radius)**\
 **const SbVec3f &**	**getCenter() const**\
 **float**	**getRadius() const**\
 **void**	**circumscribe(const SbBox3f &box)**\
 **SbBool**	**intersect(const SbLine &l, SbVec3f &intersection) const**\
 **SbBool**	**intersect(const SbLine &l, SbVec3f &enter, SbVec3f &exit) const**

## DESCRIPTION

**Represents a sphere in 3D. This is a lightweight datatype that is used for arguments or return values in the Inventor toolkit. See SoSphere** for a database sphere (used for rendering, picking, etc.).

## METHODS

	**SbSphere()**\
 	**SbSphere(const SbVec3f &center, float radius)**\
 Constructors.

**void**	**setValue(const SbVec3f &center, float radius)**\
 Change the center and radius.

**void**	**setCenter(const SbVec3f &center)**\
 **void**	**setRadius(float radius)**\
 Set just the center or radius.

**const SbVec3f &**	**getCenter() const**\
 **float**	**getRadius() const**\
 Return the center and radius.

**void**	**circumscribe(const SbBox3f &box)**\
 Return a sphere containing a given box.

**SbBool**	**intersect(const SbLine &l, SbVec3f &intersection) const**\
 **SbBool**	**intersect(const SbLine &l, SbVec3f &enter, SbVec3f &exit) const**\
 Intersect line and sphere, returning TRUE if there is an intersection. The line is treated as a ray.

## SEE ALSO

**SbVec3f, SbLine, SoSphere**
