JXG.Sphere3D

Class

Creates a new 3D sphere object. Do not use this constructor to create a 3D sphere. Use JXG.View3D#create with type Sphere3D instead.

Attributes

Own

none

Inherited

Members

Own

(private) aux2D : Array

Description

Elements supporting the 2D representation.

Type
Array
Source
3d/sphere3d.js, line 106

center : JXG.Point3D

Description

The sphere's center. Do not set this parameter directly, as that will break JSXGraph's update system.

Type
JXG.Point3D
Source
3d/sphere3d.js, line 84

element2D : GeometryElement

Description

The 2D representation of the element.

Type
GeometryElement
Overrides
JXG.GeometryElement3D#element2D
Source
3d/sphere3d.js, line 99

method : String

Description

The construction method. Can be:

  • 'twoPoints' - The sphere is defined by its center and a point on the sphere.
  • 'pointRadius' - The sphere is defined by its center and its radius in user units.
Type
String
See
Source
3d/sphere3d.js, line 78

point2 : JXG.Point3D

Description

A point on the sphere; only set if the construction method is 'twoPoints'. Do not set this parameter directly, as that will break JSXGraph's update system.

Type
JXG.Point3D
See
Source
3d/sphere3d.js, line 91

projectionType : String

Description

The type of projection ('parallel' or 'central') that the sphere is currently drawn in.

Type
String
Source
3d/sphere3d.js, line 112

range_u : Array

Description

The parameter range of u

Type
Array
Source
3d/sphere3d.js, line 192

range_v : Array

Description

The parameter range of v

Type
Array
Source
3d/sphere3d.js, line 198

Inherited

Methods

Own

Radius(valueopt) → {Number}

Calculates the radius of the circle.

Parameters

Name Type Attributes Description
value String | Number | function <optional>

Set new radius

Returns

The radius of the circle

Type
Number

Details

Source
3d/sphere3d.js, line 227

X(u, v) → {Number}

Returns the x-coordinate of the sphere given as parametric surface for parameters u and v.

Parameters

Name Type Description
u Number
v Number

Returns

x-coordinate

Type
Number

Details

Source
3d/sphere3d.js, line 161

Y(u, v) → {Number}

Returns the y-coordinate of the sphere given as parametric surface for parameters u and v.

Parameters

Name Type Description
u Number
v Number

Returns

y-coordinate

Type
Number

Details

Source
3d/sphere3d.js, line 172

Z(u, v) → {Number}

Returns the z-coordinate of the sphere given as parametric surface for parameters u and v.

Parameters

Name Type Description
u Number
v Number

Returns

z-coordinate

Type
Number

Details

Source
3d/sphere3d.js, line 183

buildProjection(attr)

Create 2D helper points and an ellipse to visualize the sphere3d. Handles central and parallel projection simultaneously.

This is done only once at creation time.

Parameters

Name Type Description
attr object

Attributes for the sphere objects

Details

Source
3d/sphere3d.js, line 362

focusFn(sgn) → {Array}

The central projection of a sphere is an ellipse. The front and back points of the sphere -- that is, the points closest to and furthest from the screen -- project to the foci of the ellipse.

To see this, look at the cone tangent to the sphere whose tip is at the camera. The image of the sphere is the ellipse where this cone intersects the screen. By acting on the sphere with scalings centered on the camera, you can send it to either of the Dandelin spheres that touch the screen at the foci of the image ellipse.

This factory method produces two functions, focusFn(-1) and focusFn(1), that evaluate to the projections of the front and back points of the sphere, respectively.

The parallel projection of a sphere is a cicle. We use an ellipse curve for this projection, too. The two focii now coincide with the center of the sphere. The 2D radius point is defined by the projection of the center and the projected radius.

Parameters

Name Type Description
sgn Number

Expecst -1 or 1 for the two focus points

Returns

2D coordinates of the projected focus point

Type
Array

Details

Source
3d/sphere3d.js, line 271

innerVertexFn() → {Array}

Returns

2D coordinates of the projected 3rd point that is on the ellipse.

Type
Array

Details

Source
3d/sphere3d.js, line 297

setRadius(r) → {JXG.Sphere3D}

Set a new radius, then update the board.

Parameters

Name Type Description
r String | Number | function

A string, function or number describing the new radius

Returns

Reference to this sphere

Type
JXG.Sphere3D

Details

Source
3d/sphere3d.js, line 214

Inherited

Events

Own

none

Inherited

Parameters

Name Type Description
view JXG.View3D

The 3D view the sphere is drawn on.

method String

Can be:

  • 'twoPoints' The sphere is defined by its center and a point on the sphere.
  • 'pointRadius' The sphere is defined by its center and its radius in user units.

The parameters p1, p2 and radius must be set according to this method parameter.

par1 Point3D

The center of the sphere.

par2 Point3D

Can be:

  • A point on the sphere (if the construction method is 'twoPoints')
  • A number or function (if the construction method is 'pointRadius')
attributes Object

An object containing visual properties like in JXG.Options#point3d and JXG.Options#elements, and optional a name and an id.

Details

See
Source
3d/sphere3d.js, line 61

Extends