GE Lua Documentation

Press F to search!

catmullRom

Definition


-- @/lua/common/mathlib.lua:1290

-- x, y, z independent from each other (no distance needed)
function catmullRom(p0, p1, p2, p3, t, s)
  return cardinalSpline(p0, p1, p2, p3, t, s or 0.5, 1, 1, 1)
end

Callers

@/lua/ge/extensions/editor/terraform/fetchSources.lua
    for q = startIdx, 1, 0.1 do
      table.insert(nodes, catmullRom(p1, p2, p3, p4, q, 0.5))
      table.insert(normals, catmullRom(n1, n2, n3, n4, q, 0.5))
      table.insert(nodes, catmullRom(p1, p2, p3, p4, q, 0.5))
      table.insert(normals, catmullRom(n1, n2, n3, n4, q, 0.5))
      table.insert(widths, catmullRom(tmp1, tmp2, tmp3, tmp4, q, 0.5).z)
      table.insert(normals, catmullRom(n1, n2, n3, n4, q, 0.5))
      table.insert(widths, catmullRom(tmp1, tmp2, tmp3, tmp4, q, 0.5).z)
    end
@/lua/vehicle/controller/tech/roadsSensor.lua
        --obj.debugDrawProxy:drawSphere(0.1, disc[ctr] + vec3(0, 0, 0.25), color(255, 255, 255, 255))
        wds[ctr] = catmullRom(w0, w1, w2, w3, q, splineSmoothness)
        curv[ctr] = k1 + dk*q
@/lua/ge/extensions/editor/tech/roadArchitect/roads.lua
        local pp1, pp2, pp3, pp4 = nodes[max(1, i - 2)], p1, p2, nodes[min(#nodes, i + 1)]
        local p = catmullRom(pp1, pp2, pp3, pp4, 0.5)
        tmp0:set(pp1.x, pp1.y, widths[max(1, i - 2)])
        tmp3:set(pp1.x, pp1.y, widths[min(#nodes, i + 1)])
        local w = catmullRom(tmp0, tmp1, tmp2, tmp3, 0.5).z
        nOut[ctr], wOut[ctr] = p, w
@/lua/ge/extensions/editor/terrainAndRoadImporter.lua
      local q = j * numDivsInv
      pDiv[ctr] = catmullRom(p1, p2, p3, p4, q)
      tmp1:set(p1.x, p1.y, widths[i1] * 0.5)
      tmp4:set(p4.x, p4.y, widths[i4] * 0.5)
      wDiv[ctr] = catmullRom(tmp1, tmp2, tmp3, tmp4, q).z
      ctr = ctr + 1