classSettings |
object
|
HyperSphere class settings.
Properties
| Name |
Type |
Attributes |
Default |
Description |
compute |
object
|
<optional>
|
{}
|
Methods for compute vertices
Properties
| Name |
Type |
Attributes |
Default |
Description |
isUseCPU |
boolean
|
<optional>
|
false
|
true - Uses CPU for compute.
false - Uses GPU for compute.
Currently have effect for Hypersphere Universe only. Uses CPU for all other cases.
|
config |
object
|
<optional>
|
{}
|
A configuration of an iterative process in which is resolving the Thomson Problem,
at each step, all vertices gradually move toward a position in which the vertices are at the maximum distance from each other.
See my prompts in deepseek or gemini for details.
Simple example of the iteration.
Properties
| Name |
Type |
Attributes |
Default |
Description |
RANDOM_POINTS |
number
|
<optional>
|
1
|
After сomputing a vertice's position, a random deviation is added to the vertice's position.
If a vertice's position to calculate multiple times, a cloud of random deviations will form around the true vertice position.
Select one:
0 - A random position is not calculated. Instead, PSEUDO_RANDOM is returned. PSEUDO_RANDOM see below.
Use this option for debugging. Algoritm will returns same vertice position for every running.
1 - A random deviation is added to the vertice's position.
The JavaScript random() function is used to generate a random deviation when calculating on the CPU.
On the GPU, hashing is used to generate a random number. A Permuted Congruential Generator (PCG) is used.
Random value have range from 0 to 1.
Random deviation is null if random value is 0.
Vertice position moves to oppozite position of the hypersphere if random value is 1.
|
PSEUDO_RANDOM |
float
|
<optional>
|
0.5
|
Have effect only if RANDOM_POINTS = 0. Available range from 0 to 1. |
DAMPING |
float
|
<optional>
|
0.95
|
Damping is a velocity reduction factor applied at each iteration step.
It simulates friction or energy dissipation in the system.
Without damping, particles would oscillate indefinitely around equilibrium positions, never stabilizing.
Valid DAMPING value range:
0 - Heavy damping, quick stopping. Fast stabilization, no oscillations
1 - No damping. Not recommended for production
What is DAMPING and why is it needed?
|
REPULSION_STRENGTH |
float
|
<optional>
|
|
A force scaling factor that determines how strongly particles repel each other.
It's the coefficient that multiplies the inverse-square force law between every pair of vertices.
The smaller the value, the weaker the repulsive forces between the vertices, and the slower they move.
Available range from 0 to ∞.
0 - No repulsion, particles don't interact. Static positions, no movement
∞ - No upper bound (but practically limited by numerical stability).
default vaue is config.a / classSettings.settings.object.geometry.angles.length. See below.
What is REPULSION_STRENGTH and why is it needed?
|
a |
float
|
<optional>
|
50
|
See above. Have effect if REPULSION_STRENGTH is not defined. |
p |
float
|
<optional>
|
0
|
Hyperbola parametr. See RandomVertice.calculateHyperbola.
At each iteration step, a random offset is added after the vertex position is calculated.
This random offset makes the vertex positions unpredictable with each new iteration.
In other words, a certain noise is added to the vertex positions.
The distribution of this noise in the hypersphere space forms a probability cloud of the vertex
position around the calculated position.
The larger p, the denser this cloud is around the calculated point position.
0 - Direct line: y = x (from (0,0) to (π,π)).
The density of the probability cloud is minimal.
Therefore, the probability of the vertice position deviating from the calculated position is maximized.
1 - Two segments: vertical and horizontal.
The probability cloud collapses to a single point and is equal to the calculated vertice position.
No noise is added in this case.
0 < p < 1 Hyperbola. See how the hyperbola's shape curve depends on p.
|
LOG |
boolean
|
<optional>
|
|
true - log to console all calculated vertices. WARNING! This configuration significantly increases iteration time! Use for debugging only. |
|
|
distanceOfVertices |
function
|
|
|
Function, that was imported from:
For Circle:
middleVerticesCircle.js Moves vertices to the middle position of the opposite vertices of the vertice edges for circle.
or
averageVerticesCircle.js An iterative process in which, at each step, all vertices gradually move toward a position
in which the vertices are at the maximum distance from each other.
For Sphere:
middleVerticesSphere.js Moves vertices to the middle position of the opposite vertices of the vertice edges for sphere.
or
averageVerticesSphere.js An iterative process in which, at each step, all vertices gradually move toward a position
in which the vertices are at the maximum distance from each other.
For HyperSphere:
middleVerticesHSphere.js Moves vertices to the middle position of the opposite vertices of the vertice edges for hupersphere.
or
averageVerticesHSphere.js An iterative process in which, at each step, all vertices gradually move toward a position
in which the vertices are at the maximum distance from each other.
|
intersection |
object
|
<optional>
|
|
HyperSphere intersection.
For Circle intersector is line.
For Sphere intersector is plane.
For HyperSphere intersector is sphere.
Properties
| Name |
Type |
Attributes |
Default |
Description |
position |
float
|
<optional>
|
0.0
|
Position of the intersector.
For Circle position is Y coordinate of the intersection line.
For Sphere position is Z coordinate of the intersection plane.
For HyperSphere position is radius of the intersection sphere.
|
color |
number
|
string
|
<optional>
|
0x0000FF
|
Color of the intersector. Example: 'red'. |
|
projectParams |
object
|
<optional>
|
|
Parameters of project the hypersphere onto the canvas.
Properties
| Name |
Type |
Attributes |
Default |
Description |
scene |
THREE.Scene
|
|
|
THREE.Scene |
params |
object
|
<optional>
|
{}
|
The following parameters are available
Properties
| Name |
Type |
Attributes |
Default |
Description |
center |
object
|
<optional>
|
{x: 0.0, y: 0.0, z: 0.0}
|
center of the hypersphere
Properties
| Name |
Type |
Attributes |
Default |
Description |
x |
float
|
<optional>
|
0.0
|
X axis of the center |
y |
float
|
<optional>
|
0.0
|
Y axis of the center |
z |
float
|
<optional>
|
0.0
|
Z axis of the center |
|
|
|
r |
float
|
<optional>
|
1.0
|
HyperSphere radius. |
edges |
boolean
|
object
|
<optional>
|
{}
|
HyperSphere edges
false - Doesn't create edges to reduce the creation time of the hypersphere
Properties
| Name |
Type |
Attributes |
Default |
Description |
project |
boolean
|
<optional>
|
true
|
false - Doesn't project edges onto canvas |
creationMethod |
enum
|
<optional>
|
edgesCreationMethod.Random
|
method for creating edges. See edgesCreationMethod |
|
randomArc |
boolean
|
<optional>
|
false
|
true - creates a random arc between two vertice. |
onSelectScene |
function
|
<optional>
|
|
Callback function that called after Player time was changed.
parameter hyperSphere HyperSphere object.
parameter timeId Player index.
parameter t current time.
Also see onSelectScene type definition.
|
onAddControllers |
function
|
<optional>
|
|
Сallback function that is called when the user has selected a hypersphere. You can add new controllers to the 'Advansed' folder.
parameter fAdvansed 'Advansed' folder.
|
settings |
object
|
<optional>
|
|
The following settings are available
Properties
| Name |
Type |
Attributes |
Description |
object |
object
|
<optional>
|
HyperSphere object.
Properties
| Name |
Type |
Attributes |
Default |
Description |
name |
String
|
<optional>
|
'Circle'| 'Sphere'| 'Hypersphere'
|
name of hypersphere. |
color |
String
|
number
|
<optional>
|
'lime'
|
color of edges or vertices.
String - color name. See list of available color names in the _colorKeywords object in the Color.js file.
number - color Hex triplet. Example: 0x0000ff - blue color.
Default color is lime for Circle and Sphere.
Default color of vertice of the Hypersphere3D is depends from the altitude angle of the vertice according the options.palette parameter.
See classSettings.settings.object.geometry.angles for details. For example if options.palette is MyThree.ColorPicker.paletteIndexes.BGYW, then:
| Vertice Altitude | Vertice Color |
| 0 | white |
| π / 2 | lime |
| π | blue |
MyThree.ColorPicker.paletteIndexes.BGYW palette parameter is default.
Note: You can define color of the each vertice separately in the classSettings.settings.object.geometry.colors parameter.
|
geometry |
object
|
<optional>
|
|
HyperSphere geometry.
Properties
| Name |
Type |
Attributes |
Description |
angles |
array
|
object
|
<optional>
|
n-dimensional hypersphere vertice angles.
array - array of vertex angles.
Every item of array is n-dimensional array of vertex angles.
All the vertices of the Circle form a circle.
For Circle every vertice is array of one angle.
Vertex angle is the longitude of the circle of the hypersphere in the range from - π to π.
Vertex angle is angle of rotation around of Z axis in 3D space.
Angle is begin from X = 0, Y = 1.
Every vertex is [
Math.cos(θ),//x
Math.sin(θ)//y
] array. θ is vertex angle.
Example of Circle with three vertices is triangle:
classSettings.settings.object.geometry.angles: angles: [
[], //vertice[0] = [0 ,1]
[Math.PI * 2 / 3], //vertice[1] = [0.8660254037844387 ,-0.4999999999999998]
[- Math.PI * 2 / 3] //vertice[2] = [-0.8660254037844387 ,-0.4999999999999998]
],
All the vertices of the Sphere form a sphere.
For Sphere every vertice is array of two angles.
The first vertex angle is the latitude of the sphere of the hypersphere in the range from - π / 2 to π / 2.
Zero latitude is located at the equator.
The second vertex angle is the longitude of the sphere of the hypersphere in the range from - π to π.
The second vertex angle is angle of rotation of the cross section around of Y axis.
Example of Sphere with 4 vertices is pyramid:
classSettings.settings.object.geometry.angles: [
[ Math.PI / 2, 0 ],//vertice[0] = [ 0 , 1 , 0 ]
[-Math.PI / 6, Math.PI * 2 * 0 / 3],//vertice[1] = [-0.8660254037844387,-0.5, 0 ]
[-Math.PI / 6, Math.PI * 2 * 1 / 3],//vertice[2] = [ 0.4330127018922192,-0.5,-0.75]
[-Math.PI / 6, -Math.PI * 2 * 1 / 3,//vertice[3] = [ 0.4330127018922195,-0.5, 0.75]
],
All the vertices of the HyperSphere3D form a hypersphere.
For HyperSphere3D every vertice is array of three angles.
The first vertex angle is the altitude of the hypersphere of the hypersphere in the range from 0 to π / 2.
Zero altitude is located at the center of the hypersphere.
The second vertex angle is the latitude of the hypersphere of the hypersphere in the range from - π / 2 to π / 2.
Zero latitude is located at the equator.
The third vertex angle is the longitude of the hypersphere of the hypersphere in the range from - π to π.
The third vertex angle is angle of rotation of the cross section around of Y axis.
Example of HyperSphere with 5 vertices is pentahedroid:
classSettings.settings.object.geometry.angles: [
[],
[Math.PI / 2, Math.PI / 2],
[
Math.PI / 2,//Altitude
- Math.PI / 6,//Latitude
Math.PI * 0,//Longitude
],
[Math.PI / 2, - Math.PI / 6, Math.PI * 2 * 1 / 3],
[Math.PI / 2, - Math.PI / 6, - Math.PI * 2 * 1 / 3],
],
object - see below:
Properties
| Name |
Type |
Attributes |
Default |
Description |
count |
number
|
<optional>
|
3|4|5
|
Count of vertices with random position.
Default values:
3 for Circle - triangle.
4 for Sphere - pyramid.
5 for HyperSphere3D - pentahedroid.
|
|
params |
object
|
<optional>
|
You can use params instead classSettings.settings.object.geometry.angles. Following angles will be added:
Properties
| Name |
Type |
Attributes |
Description |
vertice |
array
|
<optional>
|
Will be added to classSettings.settings.object.geometry.angles[0] |
oppositeVertice |
array
|
<optional>
|
Will be added to classSettings.settings.object.geometry.angles[1] |
|
times |
array
|
<optional>
|
array of vertices angles for different player Player times. See angles above.
See Player.onSelectScene for details.
Every item of the array is array of vertices angles for current Player time.
times have priority before angles.
|
colors |
array
|
<optional>
|
array of colors of vertices.
Color of the each vertice is group of three (RGB) items of the colors array in range from 0 to 1. See THREE.Color for details.
Example:
[
1, 0, 0,//First vertice is red.
0, 1, 0,//Second vertice green.
0, 0, 1,//Third vertice blue.
]
Note: Color of vertice is defined in the classSettings.settings.object.color parameter if it not exists in the colors array. |
opacity |
array
|
<optional>
|
array of opacities of each vertice. Each item of array is float value in the range of 0.0 - 1.0 indicating how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque. |
indices |
object
|
<optional>
|
Array of indices of edges of hypersphere.
Properties
| Name |
Type |
Attributes |
Description |
edges |
array
|
object
|
<optional>
|
HyperSphere edges.
array - array of edges.
Every edge is array of indices of vertices from
classSettings.settings.object.geometry.position
Example: [[0,1], [1,2], [2,0]],//triangle
object - see below:
Properties
| Name |
Type |
Attributes |
Default |
Description |
count |
number
|
<optional>
|
3
|
edges count. |
|
|
|
|
|
debug |
boolean
|
object
|
<optional>
|
false
|
Debug mode.
true - Diagnoses your code and display detected errors to console.
object - Diagnoses your code and display detected errors to console.
Properties
| Name |
Type |
Attributes |
Default |
Description |
probabilityDensity |
boolean
|
Array
|
<optional>
|
[]
|
Probability density of distribution of vertices over the surface of the hypersphere.
false - do not calculate probability density.
[] - calculate probability density.
|
testVertice |
boolean
|
<optional>
|
true
|
Test of converting of the vertice coordinates from Cartesian Coordinates to Polar Coordinates
and Polar Coordinates to Cartesian Coordinates
and display detected errors to console.
|
middleVertice |
boolean
|
<optional>
|
true
|
Middle vertice log. |
log |
boolean
|
<optional>
|
true
|
Vertices and edges log. |
edges |
boolean
|
<optional>
|
true
|
Edges log. Have effect if log = true only |
random |
function
|
<optional>
|
|
Replacing random vertices with strictly defined vertices. For example: () => { return 0.5 }. |
|
continue |
function
|
<optional>
|
|
Callback function that called after hypersphere edges was created. |
boRemove |
boolean
|
<optional>
|
|
false - do not delete the previous hypersphere while projecting a new hypersphere on scene. |
boGui |
boolean
|
<optional>
|
|
false - do not include hypersphere GUI. |
overriddenProperties |
object
|
<optional>
|
|
Overridden properties. The following properties can be override:
Properties
| Name |
Type |
Attributes |
Description |
oppositeVertice |
function
|
<optional>
|
Returns the opposite vertice.
parameter oppositeAngleId. Opposite vertice identifier.
parameter timeId. Player index is current time identifier.
|
position |
Array
|
<optional>
|
Returns an array of vertice positions. |
position0 |
Array
|
<optional>
|
Returns an array of vertice positions for the Player's start time.
See settings.options.playerOptions.min of the Player. |
updateVertices |
function
|
<optional>
|
Update vertices.
parameter vertices. Array of new vertices angles.
|
vertices |
function
|
<optional>
|
Returns an empty array of vertices. |
r |
function
|
<optional>
|
Returns a hypersphere radius.
parameter timeId. Player index is time identifier.
|
pushMiddleVertice |
function
|
<optional>
|
pushes a middle vertice into time angles array.
parameter timeId. Player index is time identifier.
parameter middleVertice. Array of the middle vertice angles to push.
|
angles |
function
|
<optional>
|
Returns a vertice angles array.
parameter anglesId. Vertice identifier.
parameter timeId. Player index is time identifier.
|
verticeAngles |
function
|
<optional>
|
Returns a vertice angles.
parameter anglesCur. Array of the vertice angles.
parameter verticeId. Vertice index.
|
verticeText |
function
|
<optional>
|
Returns a vertice text if user is move mouse over vertice.
parameter intersection.
parameter text. Callback function, what returns a vertice text.
|
text |
function
|
<optional>
|
Returns a part of the vertice text. |
|
|