Element: Sphere.

Icon: 

Text: A 3D sphere (or ellipsoid).

Description: A Sphere is a drawing element that displays a sphere or, to be more precise, an ellipsoid, or part of it, in three dimensions. The ellipsoid is determined by its center, its axes, and its size along each axis. The axes can be the usual coordinate axes or be freely set by the user, thus creating ellipsoids with any possible orientation.

The ellipsoid can be moved by dragging its center point, invoking up to three different actions.

Advanced Color Scheme

This element allows the use of an advanced color scheme for it. The user can define an origin and a direction in space so that the distance from the origin along this direction decides the color that will be used to fill the interior of the element. This can produce drawings like the one displayed below.

Table of properties

Name Description Values accepted
Position and Size
Center X The X coordinate of the center point of the element. Any constant or variable of type double or int.
Center Y The Y coordinate of the center point of the element. Any constant or variable of type double or int.
Center Z The Z coordinate of the center point of the element. Any constant or variable of type double or int.
Axis A The size of the element in the first direction. Any constant or variable of type double or int.
Axis B The size of the element in the second direction. Any constant or variable of type double or int.
Axis C The size of the element in the third direction. Any constant or variable of type double or int.

Visibility and Interaction

Visible The visibility of the element. A boolean variable or one of the constants true or false.
Enabled Whether the element responds to user interaction. A boolean variable or one of the constants true or false.
On Press The action to invoke when the element is pressed. The Java code to invoke for the action. 
On Drag The action to invoke when the element is moved. The Java code to invoke for the action. 
On Release The action to invoke when the element is released. The Java code to invoke for the action. 
On Enter The action to invoke when the pointer enters the element. The Java code to invoke for the action. 
On Exit The action to invoke when the pointer leaves the element. The Java code to invoke for the action. 
Configuration
Direction The direction for the third (C) axis. The other two are then chosen using the standard positive orientation. One of the following options:
  • X.  (Equivalent integer: 0).
  • Y.  (Equivalent integer: 1).
  • Z.  (Equivalent integer: 2).
  • CUSTOM. (Equivalent integer: 3). In thsi case, the user must specify the axes using the Axes property.

Integer constants and variables are also accepted, using any of the values indicated in the parentheses above. This allows changing the main direction in run-time.

Axes The main axes in case of "CUSTOM" direction. An array of type double with nine element. The first three correspond to the first axis (A), the next three to the second (B), and the final three to the third (C).
Min Alpha The angle for the first meridian displayed. Any constant or variable of type int, between 0  and 360. The default value is 0.
Max Alpha The angle for the last meridian displayed. Any constant or variable of type int, between 0  and 360. The default value is 360.
Min Beta The angle for the first parallel displayed. Any constant or variable of type int, between -90  and 90. The default value is -90.
Max Beta The angle for the last parallel displayed. Any constant or variable of type int, between -90  and 90. The default value is 90.
Close Bottom Whether to close the bottom part of an incomplete ellipsoid (one with Min Beta > -90). A boolean variable or one of the constants true or false.
Close Top Whether to close the top part of an incomplete ellipsoid (one with Max Beta < 90). A boolean variable or one of the constants true or false.
Close Right Whether to close the right part of an incomplete ellipsoid (one with Min Alpha > 0). A boolean variable or one of the constants true or false.
Close Left Whether to close the left part of an incomplete ellipsoid (one with Min Alpha < 360). A boolean variable or one of the constants true or false.
Graphical Aspect
Fill Color The color used to fill the element. The special value null draws an empty element. An Object variable of the class java.awt.Color or one of the predefined colors: black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow.

A color can also be specified providing its integer RGB coordinates (between 0 and 255), plus an optional transparency coordinate.

The default value is decided by the system.

Line Color The color used for the lines of the element. The special value null draws the element without an edge. See the values for the Fill Color property.
Stroke The thickness for the lines of the element. Any constant or variable of type double or int. The default value is 1.

Object variables of the class  java.awt.Stroke are also accepted.

Resolution How to divide the element in small rectangles. Three integers separated by a comma, indicating the number of partitions in the direction of the radius (for incomplete ellipsoids), and in each of the main directions (meridians and parallels).
Alternatively, a double value setting the maximum length allowed for the sides of the rectangles.
An Object variable of the class org.opensourcephysics.displayejs.Resolution is also accepted.
Displacement This is a factor that allows us to simulate that the element is located further from the observer than it actually is. This allows a better visualization of other elements that move along the surface This factor is set ussually to a value slightly bigger that one, such as 1.1. Any constant or variable of type double. The default value is 1.
Quick Transp The level of transparency to use when the element is drawn quickly (which can happen when the scene is rotated). Any constant or variable of type int.

The value must be in the range from 0 (transparent) to 255 (solid).

Advanced Color Scheme
Color Origin Defines the origin point for the computation of the color levels. A one-dimensional array of type double with three elements. One for each of the coordinates of the origin point.
Color Direction Defines the direction along which the gradient of colors takes place. A one-dimensional array of type double with three elements. One for each of the coordinates of the gradient of colors.
Color Levels Defines the number of levels that separate the zones with the same color. The number of levels must be one less than the number of colors. A one-dimensional array of type double providing the values for which a change of color takes place.
Color Fills Defines the colors to use at each side of the color leves. The number of colors must be one more than the number of levels. A one-dimensional array of type Object. Each element in the array must be the color to use in each of the zones delimited by the levels.

For the accepted values for the elements in the array, see the values for the Fill Color property. 

Threshold Below Whether to use the color of the level below for points right in the level of separation of two color zones. A boolean variable or one of the constants true or false.