Advanced Optimization
This chapter describes advanced FSL functions designed for optimizing gemstone designs, particularly for ensuring geometric integrity and achieving specific proportions.
Note: Use these functions in combination with the
assertstatement to enforce specific geometric properties of the gemstone during the optimization process. Best to make sure that the geometry is valid before running the optimization process.
Geometric Check Functions
These functions allow you to assert specific geometric properties of the gemstone during the optimization process. They are particularly useful for:
- Preventing Girdle Corruption: Ensuring the girdle remains even and vertical.
- Shape Constraints: Enforcing specific ratios like table size or depth.
isGirdleOK()
Checks if the girdle is "even". An even girdle means:
- All girdle facets (vertical facets) have the same height (within a small tolerance).
- All girdle facets are centered at the same vertical position (Z).
Usage:
assert isGirdleOK() "Girdle issue!"
Use this assertion to reject any optimization steps that result in an uneven or twisted girdle.
tablePercentage()
Calculates the ratio of the table width to the stone's total width (diameter), expressed as a percentage.
- Table Width: The width (along X-axis) of the largest facet with a normal pointing straight up (0, 0, 1).
- Stone Width: The total width of the stone along the X-axis.
Usage:
// Ensure table is between 50% and 60%
assert tablePercentage() >= 50 "Table too small!"
assert tablePercentage() <= 60 "Table too big!"
depthPercentage()
Calculates the ratio of the stone's total depth (height) to its width, expressed as a percentage.
- Total Depth: The vertical distance between the lowest and highest points of the stone.
- Stone Width: The total width of the stone along the X-axis.
Usage:
// Target a specific depth percentage
assert abs(depthPercentage() - 60) < 1 "Depth too small!"
crownHeightPercentage()
Calculates the height of the crown as a percentage of the total stone height.
- Crown Height: The vertical distance from the top of the girdle to the highest point of the stone (usually the table).
- Total Height: The vertical distance between the lowest and highest points of the stone.
Usage:
// Ensure crown height is around 15% of total height
assert abs(crownHeightPercentage() - 15) < 2 "Crown height issue!"
facetCount()
Returns the total number of facets in the gemstone.
Usage:
// Ensure the design has exactly 57 facets
assert facetCount() == 57 "Facet count issue!"
pavilionDepthPercentage()
Calculates the height of the pavilion as a percentage of the total stone height.
- Pavilion Height: The vertical distance from the bottom of the girdle to the lowest point of the stone (culet).
- Total Height: The vertical distance between the lowest and highest points of the stone.
Usage:
// Ensure pavilion depth is around 43%
assert abs(pavilionDepthPercentage() - 43) < 2 "Pavilion depth issue!"
girdleThicknessPercentage()
Calculates the average girdle thickness as a percentage of the stone's width.
- Girdle Thickness: Average vertical thickness of facets whose normals are vertical (girdle facets).
- Stone Width: The total width of the stone along the X-axis.
Usage:
// Keep girdle between 3% and 5% of width
assert girdleThicknessPercentage() >= 3 "Girdle too thin!"
assert girdleThicknessPercentage() <= 5 "Girdle too thick!"
lengthWidthRatio()
Calculates the ratio of the stone's larger dimension to its smaller dimension (Length/Width or Width/Length).
- Result: Always greater than or equal to 1.0.
Usage:
// Ensure the stone is perfectly square/round (ratio 1.0)
assert abs(lengthWidthRatio() - 1.0) < 0.01