catmullRomCentripetal
Definition
-- @/lua/common/mathlib.lua:1299
-- best stability, no loops or self-intersections
function catmullRomCentripetal(p0, p1, p2, p3, t, s)
return cardinalSpline(p0, p1, p2, p3, t, s or 0.5, sqrt(p0:distance(p1)), sqrt(p1:distance(p2)), sqrt(p2:distance(p3)))
end
Callers
@/lua/ge/extensions/editor/camPathEditor.lua
-- Set the correct rotation to the virtual marker at the start
local catMullRot = catmullRomCentripetal(r1, r2, r3, r4, 0.1):normalized()
r1 = r2:nlerp(catMullRot, -1)
-- Set the correct rotation to the virtual marker at the end
local catMullRot = catmullRomCentripetal(r1, r2, r3, r4, 0.9):normalized()
r4 = r3:nlerp(catMullRot, -1)
local rot = catmullRomCentripetal(r1, r2, r3, r4, calculateTnorm(sqrt(r1:distance(r2)), sqrt(r2:distance(r3)), sqrt(r3:distance(r4)), t1, t2, t3, camTLocal)):normalized()
local fov = monotonicSteffen(markers[n1].fov or 60, markers[n2].fov or 60, markers[n3].fov or 60, markers[n4].fov or 60, 0, t1, t1 + t2, t1 + t2 + t3, t1 + camTLocal)
@/lua/ge/extensions/editor/terraform/fetchSources.lua
for q = startIdx, 1, 0.1 do
table.insert(nodes, catmullRomCentripetal(p1, p2, p3, p4, q, 0.5))
table.insert(widths, defaultWidthForMeshSplines)
@/lua/ge/extensions/editor/scriptAIEditor.lua
if i1 == i2 then -- Edge case: Set the correct rotation to the virtual marker at the start.
local catmullRot = catmullRomCentripetal(r1, r2, r3, r4, 0.1)
catmullRot:normalize()
if i3 == i4 then -- Edge case: Set the correct rotation to the virtual marker at the end.
local catmullRot = catmullRomCentripetal(r1, r2, r3, r4, 0.9)
catmullRot:normalize()
local tNorm = calculateTnorm(sqrt(r1:distance(r2)), sqrt(r2:distance(r3)), sqrt(r3:distance(r4)), dt1, dt2, dt3, tLoc)
rot = catmullRomCentripetal(r1, r2, r3, r4, tNorm)
rot:normalize()
@/lua/ge/extensions/core/cameraModes/path.lua
-- Set the correct rotation to the virtual marker at the start
local catMullRot = catmullRomCentripetal(r1, r2, r3, r4, 0.1):normalized()
r1 = r2:nlerp(catMullRot, -1)
-- Set the correct rotation to the virtual marker at the end
local catMullRot = catmullRomCentripetal(r1, r2, r3, r4, 0.9):normalized()
r4 = r3:nlerp(catMullRot, -1)
local rot = catmullRomCentripetal(r1, r2, r3, r4, calculateTnorm(sqrt(r1:distance(r2)), sqrt(r2:distance(r3)), sqrt(r3:distance(r4)), t1, t2, t3, camTLocal)):normalized()
local fov = monotonicSteffen(markers[n1].fov or 60, markers[n2].fov or 60, markers[n3].fov or 60, markers[n4].fov or 60, 0, t1, t1 + t2, t1 + t2 + t3, t1 + camTLocal)
@/lua/ge/extensions/editor/toolUtilities/util.lua
for t = 0.1, 1.0, 0.1 do
local pt = catmullRomCentripetal(p0, p1, p2, p3, t, 0.5)
local dx, dy = pt.x - lastPt.x, pt.y - lastPt.y -- XY-plane only.
@/lua/vehicle/controller/tech/roadsSensor.lua
local q = k * splineGranInv
disc[ctr] = catmullRomCentripetal(p0, p1, p2, p3, q, splineSmoothness)
--obj.debugDrawProxy:drawSphere(0.1, disc[ctr] + vec3(0, 0, 0.25), color(255, 255, 255, 255))