Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Point Helpers Reference

When you cut a gemstone at a physical machine, you rarely measure depths with a micrometer. Instead, you look through your loupe and cut until the new facet touches a corner or an edge that is already on the stone.

Point helpers are how you do the exact same thing in code. They let you point to vertices, edges, and surfaces you have already cut and use them to anchor your next tier—whether you are writing an Angle + Point cut (@ angle : point), a Point-Pair cut (: p1 : p2), or dropping a colored marker with show() to check your work.

At a Glance: Which Helper Do I Need?

HelperSyntaxWhen to Use It
cp()cp()Starting the stone: brings pavilion mains (0, 0, -1) or crown facets (0, 0, 1) together at a central apex.
gp()gp() or gp({ index: 12, side: "Up" })Meeting the girdle: finds the girdle corner directly in front of your current tooth and angle.
mp()mp(P1, G1, !P2)Classic meetpoint cutting: finds the exact corner where specific tiers meet (and optionally excludes others with !).
edge()edge(C1:0, C1:6)Grabbing a ridge: returns the two endpoints [startPt, endPt] of the line shared by two facets.
ep()ep(edge(C1:0, C1:6), 0.5)Walking along a ridge: picks a point fractionally (0.0 to 1.0) along an edge or between two points.
prz()prz(pt) or prz(pt, P1:0)Dropping a plumb line: projects a point straight up or down (along Z) onto the stone's surface or a specific facet plane.
fred()fred(a, b, edge)Visual crossovers: finds the 3D point on an edge where construction line a–b crosses it when viewed from straight above.
grid()grid(cols, rows, x, y)Flat XY layout: divides the stone's bounding box into a flat grid at z = 0.
surface()surface(u, v)Proportional steps & checkerboards: projects fractional (u, v) coordinates (0..1) onto the 3D stone so facet widths stay proportional during optimization.
Point()Point(x, y, z)Raw coordinates: defines a fixed 3D point (x, y, z) in space.

Literal point (Point)

Point(x, y, z) returns an explicit point without relying on any cut geometry. Coordinates share the same frame as other helpers: origin at the stone center, +Z toward the crown.

Note: Point should be used sparingly, as it is absolute and not sensitive to the geometry of the cut. One good use is inside parametric outline functions such as the Oval() system function.

name = "Literal Anchor"

anchor = Point(0, 0, 1.1)
print("Anchor:", anchor)
show(anchor, "orange")
P1 0 @ 42 : anchor
-- lua script
name("Literal Anchor")

local anchor = Point(0, 0, 1.1)
print("Anchor:", anchor)
show(anchor, "orange")
TierAP("P1", 0, 42, anchor)

Center point (cp())

cp() sits on the stone's center axis. It always returns (0, 0, 1) when the active side is the crown (up) and (0, 0, -1) when the active side is the pavilion (down).

name = "Center Anchors"

// Mark the culet to check alignment
print("Center point:", cp())
show(cp(), "blue")
P1 0 @ 41 : cp() x8
-- lua script
name("Center Anchors")

-- Mark the culet to check alignment
print("Center point:", cp())
show(cp(), "blue")
TierAP("P1", 0, 41, cp(), "x8")

Girdle points (gp())

gp() identifies the Girdle Point that sits "in front" of the requested index/angle. It strictly returns existing vertices from the stone's geometry.

Inside a cut command, it borrows the current index, angle, and side automatically. Elsewhere, you must supply an options object gp({ index: ..., angle: ... }) so the helper knows where to search.

Height Selection Logic

To find the correct girdle line, gp() analyzes the stone's existing angled facets (facets that are neither vertical girdle facets nor horizontal table/culet facets):

  1. It identifies the Z-extremes of all Angled Pavilion Facets and Angled Crown Facets.
  2. It assumes the girdle lies at the interface of these cuts.
  3. It selects a target height based on the active side:
    • Pavilion cuts (down): Targets the top (max Z) of the angled pavilion facets (fallback: bottom of crown facets).
    • Crown cuts (up): Targets the bottom (min Z) of the angled crown facets (fallback: top of pavilion facets).

This ensures that even if the girdle has multiple tiers or steps, gp() locks onto the height where the main cone of the stone currently meets the girdle.

Search Plane Logic

Once the correct height is found, gp() scans the vertical girdle vertices at that height and selects the vertex that the search plane would hit first (maximum projection).

[!NOTE] ProFacet identifies girdle facets by their orientation: facets with a vertical tilt of less than 0.0001 (1e-4) are considered part of the girdle and included in the gp() search. For uneven girdle lines where gp() does not apply, use mp() instead.

name = "Girdle Pickup"
gear = 96
size = 1.0

P1 0 @ 45 : cp() x8
G1 0 @ 90 : size x16
C1 6 @ 34 : mp(P1, G1) + girdle x16

// Pick up the girdle point at index 0 explicitly
print("GP 0:", gp({ index: 0 }))
show(gp({ index: 0 }), "cyan")

// Pavilion-side girdle point
print("GP 24:", gp({ index: 24 }))
show(gp({ index: 24 }), "orange")
-- lua script
name("Girdle Pickup")
gear(96)
local girdle = Point(0, 0, 0.04)

TierAP("P1", 0, 45, cp(), "x8")
TierAD("G1", 0, 90, 1.0, "x16")
TierAP("C1", 6, 34, mp("P1", "G1"):add(girdle), "x16")

-- Pick up the girdle point at index 0 explicitly
print("GP 0:", gp({ index = 0 }))
show(gp({ index = 0 }), "cyan")

-- Pavilion-side girdle point
print("GP 24:", gp({ index = 24 }))
show(gp({ index = 24 }), "orange")

Meet points (mp)

mp searches for the intersection vertex of the tiers you name. Pass one or more tiers to include, prefix a tier with ! to exclude it, and ProFacet finds the first vertex that satisfies the filters (imagining a cutting plane approaching from outside the stone toward the center).

mp respects the current index and angle context when used inside a cut command. When used outside of a cut command, pass an options object ({ index: ..., angle: ... }) to specify where to search.

Matching Tiers vs. Explicit Indices

Think of mp as a facet filter: every positive tier you list must participate in the meetpoint, while negated tiers (!Tier) must be absent.

// Common meetpoint filter patterns
mp(C1)                              // single-tier meet
mp(C1, G1)                          // vertex where C1 and G1 meet
mp(C1, C1)                          // requires at least two facets of C1 to meet
mp(C1, G1, !C2)                     // C1 and G1 meet, excluding any vertex touching C2
mp(C1:12, C2:16)                    // specific cut indices (locks design to gear)
mp(C1, { index: 3, angle: 45.0 })   // explicit tooth/angle override
-- Common meetpoint filter patterns in Lua
mp("C1")                              -- single-tier meet
mp("C1", "G1")                        -- vertex where C1 and G1 meet
mp("C1", "C1")                        -- requires at least two facets of C1 to meet
mp("C1", "G1", "!C2")                 -- C1 and G1 meet, excluding C2
mp("C1:13", "C2:17")                  -- specific cut indices
mp("C1", { index = 3, angle = 45.0 }) -- explicit tooth/angle override

Tip: Prefer tier filters like mp(C1, C2) over hardcoded tooth indices like mp(C1:12, C2:16) whenever possible so your design stays portable across different index gears.

Example

name = "Meetpoint Examples"
gear = 96
size = 1.0
girdle = Vector(0, 0, 0.03)

P1 3 @ 41.0 : cp() x8
G1 3 @ 90.0 : size
P2 0 @ 38 : gp()
C1 3 @ 35.0 : mp(P1, P2) + girdle
C2 0 @ 38.0 : gp()
C3 2 @ 33.0 : gp()

T 0 @ 0 : mp(C2) x1

print("Blue mp:", mp(C2,T))
show(mp(C2,T), "blue")
show(mp(C1, C2, !G1), "purple")
show(mp(C1, C2, G1, !C3), "red")
show(mp(C1, C2, G1), "orange")
-- lua script
name("Meetpoint Examples")
gear(96)
local girdle = Point(0, 0, 0.04)

TierAP("P1", 3, 41.0, cp(), "x8")
TierAD("G1", 3, 90.0, 1.0)
TierAP("P2", 0, 38, gp())
TierAP("C1", 3, 35.0, mp("P1", "P2"):add(girdle))
TierAP("C2", 0, 38.0, gp())
TierAP("C3", 2, 33.0, gp())

TierAP("T", 0, 0, mp("C2"), "x1")

print("Blue mp:", mp("C2", "T"))
show(mp("C2", "T"), "blue")
show(mp("C1", "C2", "!G1"), "purple")
show(mp("C1", "C2", "G1", "!C3"), "red")
show(mp("C1", "C2", "G1"), "orange")

Edge references (edge)

edge returns the shared edge between two previously cut facets. Pass tier/index pairs (edge(C1:0, C1:6)), and the helper returns a 2-element array of endpoints [p1, p2] sorted by X, then Y, then Z coordinate.

C1 0 @ 32 : 0.08 x6
edge_arr = edge(C1:0, C1:16)
print("Edge Start:", edge_arr[0])
print("Edge End:", edge_arr[1])
show(edge_arr[0], "red")
show(edge_arr[1], "blue")
-- lua script
TierAD("C1", 0, 32, 0.08, "x6")
local edge_arr = edge("C1:0", "C1:16")
print("Edge Start:", edge_arr[1])
print("Edge End:", edge_arr[2])
show(edge_arr[1], "red")
show(edge_arr[2], "blue")

Edge interpolation (ep)

ep walks along an edge or between any two points. Supply an edge(...) (or two points) plus a factor between 0.0 and 1.0:

name = "Edge Interpolation"
size = 1.0

C1 0 @ 32 : 0.08 x16
G1 0 @ 90: size

e = edge(C1:0, C1:6)
mid_edge = ep(e, 0.5)

print("Start:", e[0])
print("End:", e[1])
print("Midpoint:", mid_edge)

show(e[0], "red")
show(e[1], "blue")
show(mid_edge, "purple")
-- lua script
name("Edge Interpolation")
local size = 1.0

TierAD("C1", 0, 32, 0.08, "x16")
TierAD("G1", 0, 90, size)

local e = edge("C1:1", "C1:7")
local mid_edge = ep(e, 0.5)

print("Start:", e[1])
print("End:", e[2])
print("Midpoint:", mid_edge)

show(e[1], "red")
show(e[2], "blue")
show(mid_edge, "purple")

Project Z (prz)

prz projects a point vertically (along the Z-axis) onto the stone or onto a specific facet's plane:

  • prz(pt): Drops the point vertically onto the stone's surface (crown or pavilion depending on the active side).
  • prz(pt, P1:0): Projects the point onto the infinite plane of the specified facet.

Fred point (fred)

fred finds the 3D point on a target edge where a construction line crosses it when viewed from above (XY projection).

  • fred(p1, p2, p3, p4): Intersects line p1–p2 with target segment p3–p4 in XY projection, returning the 3D point on p3–p4.
  • fred(p1, p2, edge): Same operation, accepting an edge(...) array as the target.
name = "Fred Point Demo"
gear = 96

P1 0 @ 42 : cp() x8
G1 0 @ 90 : size x16
C1 6 @ 34 : mp(P1, G1) + girdle x16

// Find where a construction line crosses an edge
e = edge(C1:0, C1:6)
a = mp(P1, { index: 0 })
b = mp(P1, { index: 12 })

crossing = fred(a, b, e)
show(crossing, "red")
print("Fred point:", crossing)
-- lua script
name("Fred Point Demo")
gear(96)
local girdle = Point(0, 0, 0.04)

TierAP("P1", 0, 42, cp(), "x8")
TierAD("G1", 0, 90, 1.0, "x16")
TierAP("C1", 6, 34, mp("P1", "G1"):add(girdle), "x16")

-- Find where a construction line crosses an edge
local e = edge("C1:1", "C1:7")
local a = mp("P1", { index = 0 })
local b = mp("P1", { index = 12 })

local crossing = fred(a, b, e)
show(crossing, "red")
print("Fred point:", crossing)

[!NOTE] fred is named in honor of master cutter Fred W. Van Sant, whose designs pioneered projected crossover constructions to align intricate honeycomb and floral patterns.


Index, Angle, and Side Overrides

Pass an options object to mp or gp to evaluate the helper at a specific tooth index, angle, or side:

  • index: Integer gear tooth index.
  • angle: Angle override in degrees.
  • side: "Up" / "Crown" or "Down" / "Pavilion".
name = "Attachments"
gear = 96
girdle = Vector(0, 0, 0.03)

P1 0 @ 41.5 : 0.18 x8

// Force Crown-side girdle point even if outside a Crown cut
top_edge = gp({ index: 12, side: "Up" })
print("Top edge point:", top_edge)
show(top_edge, "green")

C1 0 @ 32.2 : top_edge + girdle x8
-- lua script
name("Attachments")
gear(96)
local girdle = Point(0, 0, 0.04)

TierAD("P1", 0, 41.5, 0.18, "x8")

-- Force Crown-side girdle point even if outside a Crown cut
local top_edge = gp({ index = 12, side = "Up" })
print("Top edge point:", top_edge)
show(top_edge, "green")

TierAP("C1", 0, 32.2, top_edge:add(girdle), "x8")

Grid points (grid) & Expressive Grid (surface)

grid(x_n, y_n, x, y, [pt1, pt2])

Divides the XY bounding box of the stone (or the custom rectangle between pt1 and pt2) into x_n columns by y_n rows and returns the flat coordinate (pos_x, pos_y, 0.0) at index (x, y).

surface(u, v, [pt1, pt2], [options])

Projects fractional bounding-box coordinates (u, v from 0.0 to 1.0) vertically onto the 3D surface of the stone. Ideal for step cuts (see Step Cut) and checkerboards (see Checkerboard Cut) because facet proportions remain locked even when the Optimizer changes the angles!

name = "Surface Grid Demo"
gear = 96
P1 0 @ 42 : cp() x8
G1 0 @ 90 : size x8
C1 0 @ 35 : mp(P1, G1) + girdle x8

p_down = surface(0.5, 0.5, { side: "down" })
p_up = surface(0.75, 0.5, { side: "up" })

show(p_up, "blue")
show(p_down, "yellow")
print("Crown surface point:", p_up)
-- lua script
name("Surface Grid Demo")
gear(96)
local girdle = Point(0, 0, 0.04)

TierAP("P1", 0, 42, cp(), "x8")
TierAD("G1", 0, 90, 1.0, "x8")
TierAP("C1", 0, 35, mp("P1", "G1"):add(girdle), "x8")

local p_down = surface(0.5, 0.5, { side = "down" })
local p_up = surface(0.75, 0.5, { side = "up" })

show(p_up, "blue")
show(p_down, "yellow")
print("Crown surface point:", p_up)