indices |
Array
|
<optional>
|
|
Array of indices of vertices of the n-dimensional graphical object.
Allows for vertices to be re-used across multiple segments.
Indices is divided to segments:
indices[0] is edges. Every edge is two indexes of the edge's vertices. Used in 1D objects and higher.
indices[1] is faces. Every face is three indexes of the edges from indices[0]. Used in 3D objects and higher.
indices[2] is bodies. Every bodie is four face indexes from indices[1]. Used in 4D objects and higher.
For example:
n = 1 line.
settings.object.geometry.position = [
[-0.5, 1],//0
[0.5]//1
]
settings.object.geometry.indices = [
[
0,//index of the settings.object.geometry.position[0] = [-0.5, 1]
1,//index of the settings.object.geometry.position[1] = [0.5]
]//0
]//0
n = 2 triangle
settings.object.geometry.position = [
[-0.7, 0.2],//0
[0.8, 0.6],//1
[0.1, -0.5]//2
],
//edges
settings.object.geometry.indices[0] = [
[0, 1],//0 index of the settings.object.geometry.positions [-0.7, 0.2] and [0.8, 0.6]
[0, 2],//1 index of the settings.object.geometry.positions [-0.7, 0.2] and [0.1, -0.5]
[1, 2] //2 index of the settings.object.geometry.positions [0.8, 0.6] and [0.1, -0.5]
]
n = 3 tetrahedron.
settings.object.geometry.position = [
[0.8, -0.6, 0.1],//0
[0.9, 0.7, 0.5],//1
[0.8, 0, -0.4],//2
[-0.6, 0.1, 0.1]//3
],
//edges
settings.object.geometry.indices[0] = [
[0, 1]//0 index of the settings.object.geometry.positions [0.8, -0.6, 0.1] and [0.9, 0.7, 0.5]
[0, 2]//1 index of the settings.object.geometry.positions [0.8, -0.6, 0.1] and [0.8, 0, -0.4]
[0, 3]//2 index of the settings.object.geometry.positions [0.8, -0.6, 0.1] and [-0.6, 0.1, 0.1]
[1, 2]//3 index of the settings.object.geometry.positions [0.9, 0.7, 0.5] and [0.8, 0, -0.4]
[1, 3]//4 index of the settings.object.geometry.positions [0.9, 0.7, 0.5] and [-0.6, 0.1, 0.1]
[2, 3]//5 index of the settings.object.geometry.positions [0.8, 0, -0.4] and [-0.6, 0.1, 0.1]
]
//faces. Indices of the edges settings.object.geometry.indices[0]
settings.object.geometry.indices[1] = [
[0, 1, 3]//tetrahedron's face 0
[0, 2, 4]//tetrahedron's face 1
[3, 4, 5]//tetrahedron's face 2
[1, 2, 5]//tetrahedron's face 3
]
n = 4 pentachoron 5-cell.
settings.object.geometry.position = [
[0.8, -0.6, 0.1, -0.85],//0
[0.9, 0.7, 0.5, -0.55],//1
[0.8, 0, -0.4, 0],//2
[-0.6, 0.1, -0.3, 0.55],//3
[-0.5, 0.2, 0.3, 0.85],//4
],
//edges
settings.object.geometry.indices[0] = [
[0, 1]//0 index of the settings.object.geometry.positions [0.8, -0.6, 0.1, -0.85] and [0.9, 0.7, 0.5, -0.55]
[0, 2]//1 index of the settings.object.geometry.positions [0.8, -0.6, 0.1, -0.85] and [0.8, 0, -0.4, 0]
[0, 3]//2 index of the settings.object.geometry.positions [0.8, -0.6, 0.1, -0.85] and [-0.6, 0.1, -0.3, 0.55]
[0, 4]//3 index of the settings.object.geometry.positions [0.8, -0.6, 0.1, -0.85] and [-0.5, 0.2, 0.3, 0.85]
[1, 2]//4 index of the settings.object.geometry.positions [0.9, 0.7, 0.5, -0.55] and [0.8, 0, -0.4, 0]
[1, 3]//5 index of the settings.object.geometry.positions [0.9, 0.7, 0.5, -0.55] and [-0.6, 0.1, -0.3, 0.55]
[1, 4]//6 index of the settings.object.geometry.positions [0.9, 0.7, 0.5, -0.55] and [-0.5, 0.2, 0.3, 0.85]
[2, 3]//7 index of the settings.object.geometry.positions [0.8, 0, -0.4, 0] and [-0.6, 0.1, -0.3, 0.55]
[2, 4]//8 index of the settings.object.geometry.positions [0.8, 0, -0.4, 0] and [-0.5, 0.2, 0.3, 0.85]
[3, 4]//9 index of the settings.object.geometry.positions [-0.6, 0.1, 0.1, 0.55] and [-0.5, 0.2, 0.3, 0.85]
]
//faces. Indices of the edges settings.object.geometry.indices[0]
settings.object.geometry.indices[1] = [
[7, 8, 9],//0 no 0, 1 vertices
[5, 6, 9],//1 no 0, 2 vertices
[4, 6, 8],//2 no 0, 3 vertices
[4, 5, 7],//3 no 0, 4 vertices
[2, 3, 9],//4 no 1, 2 vertices
[1, 3, 8],//5 no 1, 3 vertices
[1, 2, 7],//6 no 1, 4 vertices
[0, 3, 6],//7 no 2, 3 vertices
[0, 2, 5],//8 no 2, 4 vertices
[0, 1, 4],//9 no 3, 4 vertices
]
//bodies. Indices of the faces settings.object.geometry.indices[1]
settings.object.geometry.indices[2] = [
[2, 1, 3, 0],//0 no 0 vertice
[5, 6, 4, 0],//1 no 1 vertice
[8, 7, 1, 4],//2 no 2 vertice
[9, 7, 2, 5],//3 no 3 vertice
[9, 8, 3, 6],//4 no 4 vertice
]
|