function draw(self: PathMeasureDemo, renderer: Renderer)
-- Draw the base path
renderer:drawPath(self.path, pathPaint)
local measure = self.path:measure()
local len = measure.length
-- warp: map a grid of points onto the path using distance (x) and
-- perpendicular offset (y), then draw a dot at each warped position
self.warpPath:reset()
local cols, rows = 16, 3
local gap = 20
for col = 0, cols do
for row = -rows, rows do
local srcX = (col / cols) * len
local srcY = row * gap
local warped = measure:warp(Vector.xy(srcX, srcY))
drawDot(self.warpPath, warped.x, warped.y, 3)
end
end
renderer:drawPath(self.warpPath, warpPaint)
end