Cutting
Indices
Meetpoints and Edges
- meet()
- between()
- findEdge()
- onEdge()
- level()
- meetGirdle()
- centerPoint()
- show()
- matchX()
- matchZ()
- point()
- setSize()
Design Info
CAM
- createRectangle()
- createTruncatedRectangle()
- createTruncatedSquare()
- createCushionedTruncatedSquare()
- createEllipse()
- createTruncatedTriangle()
Algorithmic Design
- generateSignCombinations()
- generateEvenSignCombinations()
- generateEvenPermutationsForArrayOfPoints()
- cutMagic()
Miscellaneous
Documentation • Docs
Documentation
Classes
Color
Constructors
new Color()
new Color():
Color
Returns
Properties
Aqua
static
Aqua:string
="#00FFFF"
Black
static
Black:string
="#000000"
Blue
static
Blue:string
="#0000FF"
Champagne
static
Champagne:string
="#785623"
Fuchsia
static
Fuchsia:string
="#FF00FF"
Gray
static
Gray:string
="#808080"
Green
static
Green:string
="#008000"
Lime
static
Lime:string
="#00FF00"
Maroon
static
Maroon:string
="#800000"
Navy
static
Navy:string
="#000080"
Olive
static
Olive:string
="#808000"
Purple
static
Purple:string
="#800080"
Red
static
Red:string
="#FF0000"
Silver
static
Silver:string
="#C0C0C0"
SmokyQuartz
static
SmokyQuartz:string
="#886644"
Teal
static
Teal:string
="#008080"
White
static
White:string
="#FFFFFF"
Yellow
static
Yellow:string
="#FFFF00"
Shape
Constructors
new Shape()
new Shape():
Shape
Returns
Properties
Briolette
static
Briolette:string
="Briolette"
Cushion
static
Cushion:string
="Cushion"
Diamond
static
Diamond:string
="Diamond"
Emerald
static
Emerald:string
="Emerald"
Freeform
static
Freeform:string
="Freeform"
Heart
static
Heart:string
="Heart"
Heptagon
static
Heptagon:string
="Heptagon"
Hexagon
static
Hexagon:string
="Hexagon"
Marquise
static
Marquise:string
="Marquise"
Nonagon
static
Nonagon:string
="Nonagon"
Octagon
static
Octagon:string
="Octagon"
Oval
static
Oval:string
="Oval"
Pear
static
Pear:string
="Pear"
Pentagon
static
Pentagon:string
="Pentagon"
Rectangle
static
Rectangle:string
="Rectangle"
Round
static
Round:string
="Round"
Shield
static
Shield:string
="Shield"
Square
static
Square:string
="Square"
Tablet
static
Tablet:string
="Tablet"
Triangle
static
Triangle:string
="Triangle"
Vector
3D Vector Class
Constructors
new Vector()
new Vector():
Vector
Returns
Properties
x
x:
number
y
y:
number
y is the up-down axis.
z
z:
number
Methods
add()
add(
v
):Vector
Returns the sum of this vector and v.
Parameters
• v: Vector
Returns
addY()
addY(
dy
):Vector
Returns the a vector with dy added to y. (to move up)
Parameters
• dy: number
Returns
mul()
mul(
v
):Vector
Returns the vector scaled by v.
Parameters
• v: number
Returns
sub()
sub(
v
):Vector
Returns the difference of this vector with v.
Parameters
• v: Vector
Returns
Variables
girdle
const
girdle:Vector
The girdle is a constant Vector meant to be added to an existing meetpoint to create a girdle. The value is set to a reasonable value (0, 0.05, 0). If this is too big or too small for your design the easiest way is the multiply this constant by a scalar, e.g.: girdle.mul(1.5)
mirrored
const
mirrored:true
=true
A constant with the value “true”. This can improve readability when setting the symmetry: e.g. setSym(3, mirrored) or setSym(4, !mirrored)
Functions
between()
between(
point1
,point2
,r
?):Vector
Between returns a point between the two given points. The ratio r defines how far from the point1 the result will be. r=0.5 means in the middle.
Parameters
• point1: Vector
• point2: Vector
• r?: number
Returns
centerPoint()
centerPoint():
Vector
Returns a low or high centerpoint depending on whether we are cutting the crown or pavilion.
Returns
createCushionedTruncatedSquare()
createCushionedTruncatedSquare(
cushion
,truncate
,angle
):void
Parameters
• cushion: number
• truncate: number
• angle: number
Returns
void
createEllipse()
createEllipse(
a
,b
,num_points
,pointy
,height
?,adjust
?):void
Parameters
• a: number
• b: number
• num_points: number
• pointy: boolean
• height?: number
• adjust?: number
Returns
void
createRectangle()
createRectangle(
ratio
,angle
):void
Parameters
• ratio: number
• angle: number
Returns
void
createTruncatedRectangle()
createTruncatedRectangle(
ratio
,truncate
,angle
):void
Parameters
• ratio: number
• truncate: number
• angle: number
Returns
void
createTruncatedSquare()
createTruncatedSquare(
truncate
,angle
):void
Parameters
• truncate: number
• angle: number
Returns
void
createTruncatedTriangle()
createTruncatedTriangle(
truncate
,angle
):void
Parameters
• truncate: number
• angle: number
Returns
void
crown()
crown():
void
Sets the crown as the current cut side.
Returns
void
cut()
cut(
tier_name
,indices
,angle_or_point
,point_or_number
,instructions
?):void
This is a function that performs a cut based on an index, angle and point.
Parameters
• tier_name: string
The tier name.
• indices: number
[]
The indices to cut. Use index(), rangeIndex(), range(), list(), or table() to specify the indices.
• angle_or_point: any
The cut angle in degrees, OR a point to cut through
• point_or_number: any
A point to cut through, OR the depth of the cut.
• instructions?: string
Optional cutting instructions in case the automated instructions didn’t work well.
Returns
void
cutMagic()
cutMagic(
points
):void
Parameters
• points: number
[][]
Returns
void
deg2rad()
deg2rad(
d
):number
Parameters
• d: number
Returns
number
findEdge()
findEdge(
f1
,f2
):Vector
[]
Tries to find the edge between two facets. Returns the two endpoints of that edge.
Parameters
• f1: string
• f2: string
Returns
Vector
[]
GemCadImport()
GemCadImport(
value
):void
Parameters
• value: string
Returns
void
generateEvenPermutationsForArrayOfPoints()
generateEvenPermutationsForArrayOfPoints(
points
):number
[][]
Parameters
• points: number
[][]
Returns
number
[][]
generateSignCombinations()
generateSignCombinations(
points
,index
):number
[][]
Parameters
• points: number
[]
• index: number
[]
Returns
number
[][]
getIndexGear()
getIndexGear():
number
Get the number of indices on the index gear.
Returns
number
index()
index(
base_index
):number
[]
This function takes the base index and creates all indices base on the chosen symmetry.
Parameters
• base_index: number
Returns
number
[]
indexFrac()
indexFrac(
point1
,point2
,point3
):number
Constructs a plane through the three points given, and returns the index that would be needed to cut through all three points. Note that this in general will be a fractional number.
Parameters
• point1: Vector
• point2: Vector
• point3: Vector
Returns
number
indexRange()
indexRange(
base_index
,increment
):number
[]
This function takes the base index + increments and creates all indices base on the chosen symmetry.
For example, on a 96 index-gear and symmetry = 4, indexRange(16,3) would produce [16, 19, 22] + [40, 43, 46] + [64, 67, 70] + [88, 91, 94]
You are probably doing something wrong if you need this function.
Parameters
• base_index: number
• increment: number
Returns
number
[]
level()
level(
index
?):Vector
Tries to find a point to level the girdle, as seen from the active index.
Parameters
• index?: number
Returns
list()
list(…
indices
):number
[]
Use list() to specify each index indivdually that needs to be cut. No symmetry will be applied.
Parameters
• …indices: number
[]
The indices to cut. Ordering doesn’t matter, except for the first element and if the meet() function is used. The first index will be the base index and used by meet().
Returns
number
[]
cut("A", list(3, 6, 77), 42, centerPoint())
// Or, set from an array:
let arr = [4,7]
cut("B", list(...arr), 43, centerPoint())
matchX()
matchX(
line
,point
):Vector
A constrained linear projection of a point onto a line in 3D, where the constraint is that the x-coordinate of the projected point is fixed and equal to the original point’s x-coordinate.
Parameters
• line: Vector
[]
• point: Vector
Returns
matchZ()
matchZ(
line
,point
):Vector
A constrained linear projection of a point onto a line in 3D, where the constraint is that the z-coordinate of the projected point is fixed and equal to the original point’s z-coordinate.
Parameters
• line: Vector
[]
• point: Vector
Returns
meet()
meet(
list
,index
?):Vector
Meet returns the highest meetpoint that matches the input string. The string should contain the name of the facets meeting at the point, often a single facet name is enough to get the point.
This list should be separated by commas. To spefify facets that should NOT match the point write an ! in front of it. For example: meet(“A, !B”).
Important: The meetpoint matching algorithm needs to know from which index it should start looking. When meet() is used in a cut command the index will be set automatically. In other cases an index should be provided.
Parameters
• list: string
• index?: number
Returns
meetGirdle()
meetGirdle(
index
?):Vector
Tries to find a point meeting the girdle, as seen from the active index.
Parameters
• index?: number
Returns
onEdge()
onEdge(
f1
,f2
,c
):Vector
Tries to find a point on the specified edge and distance.
Parameters
• f1: string
• f2: string
• c: number
Returns
pavilion()
pavilion():
void
Set the pavilion as the current cut side.
Returns
void
point()
point(
x
,y
,z
):Vector
Creates a point (or vector). Y axis is up.
let p = point(1, 0.3, 0.5)
show(p, Color.Red);
Parameters
• x: number
• y: number
• z: number
Returns
rad2deg()
rad2deg(
r
):number
Parameters
• r: number
Returns
number
range()
range(
start
,increment
):number
[]
Use range to specify a range of indices. It will begin at “start” and repeatedly will increment the value [start + 0increment, start + 1increment, start + 2*increment, … ]
Parameters
• start: number
• increment: number
Returns
number
[]
setAbsorption()
setAbsorption(
value
):void
Light absorption of the stone. This only has effect on the raytraced 3D rendering. Values should be in the range 0..10
Parameters
• value: number
Returns
void
setColor()
setColor(
hex
):void
The color of the stone as a string with hex values (eg, “#FFFF00” for yellow). This only has effect on the raytraced 3D rendering.
Parameters
• hex: string
Returns
void
setDesigner()
setDesigner(
info
):void
The name of the creator of this design.
Parameters
• info: string
Returns
void
setIndexGear()
setIndexGear(
n
):void
Set the number of indices on the index gear that should be used.
Parameters
• n: number
The number of indices
Returns
void
setIndexGear(120)
setInfo()
setInfo(
info
):void
To add useful info related to the design.
Parameters
• info: string
Returns
void
setName()
setName(
name
):void
The name or title of this design.
Parameters
• name: string
Returns
void
setRI()
setRI(
ri
):void
Refractive Index of the stone. This only has effect on the raytraced 3D rendering.
Parameters
• ri: number
Returns
void
setShape()
setShape(
name
):void
The shape info. Only used for searching and filtering. Note that you are allowed to write anything here, but only a limited number of basic shapes are directly selectable in the UI. A text search will match the info given here. The shapes as used by search/filtering: Round, Oval, Pear, Triangle, Rectangle, Square, Pentagon, Hexagon, Heptagon and Octagon.
Parameters
• name: string
Returns
void
setSize()
setSize():
number
Returns a number that is 1 unit from the center. Used to set the size of the stone.
Returns
number
setSym()
setSym(
n
,mirrored
):void
Set the symmetry for the cuts that follow. It is possible to use multiple symmetries within the same design.
Parameters
• n: number
This is the radial symmetry: the number of steps needed to rotate the design completely around.
• mirrored: boolean
Whether to use mirrored-image symmetry as well (true or false).
Returns
void
setSym(3, false)
// It improves readability when using the constant "mirrored" (=true)
setSym(8, mirrored)
// Or negate:
setSym(8, !mirrored)
show()
show(
pt
,color
?):void
Show() is a debug function to visualize points on the stone.
Parameters
• pt: Vector
the 3d point.
• color?: string
the (optional) color to be used e.g. “#55ee00” or Color.Red
Returns
void
let p = point(1, 0.3, 0.5)
show(p, Color.Red);
show(meet("A, 2")) // Default color
table()
table():
number
[]
Returns an array with one element “0”. Can be used as the index to use in a call to cut() to specify the cut for the table.
Returns
number
[]
test()
test(
tier_name
,indices
,angle_or_point
,point_or_number
,instructions
?):void
Test works takes the same imput as cut(). It will viesualize how the cut would work out, for the first index.
Parameters
• tier_name: string
• indices: number
[]
• angle_or_point: any
• point_or_number: any
• instructions?: string
Returns
void