Notifications
Clear all

[Closed] Aligning matrices along a spline path?

It would be better if you explained what logic you want to follow, I’m afraid I don’t quite get it. Using refTM, they will be different, they are based on a matrix (or rather its z-axis component) that’s different from unit matrix. When the two directions will be similar, the results will be somewhat similar, too, when not… well, see the attached picture, what component of the green XYZ system would you like to keep and why?

The simplest and clearest answer is that I want the matrices of the second line to be treated the same as if it were a continuation of the first line immediately after the point where it connects.

And what criteria do you have for that, that aren’t met? Because they are treated and computed as such, the only thing that would be different if it were a continuous spline would be that here you’re giving it a source matrix at the point of connection (knot ‘b’) and if it were a single spline, you’d be giving it matrix at point ‘b-1’, i.e. the previous point on the line.

Um. I have tried to adapt the function to my current needs, but I can’t do that so that the Y-axis always has an angle of 90 with the UpVector [0.0.1] with save Direction.


fn getMatricesAlongSplineCurve spl curve count =
(
    local lastTangent = tangentCurve3D spl curve 0
    local lastRot = arbAxis lastTangent as quat
    local step = 1. / count

    for i = 1 to count collect
    (
        local location = interpCurve3D spl curve (i * step)
        local tangent = tangentCurve3D spl curve (i * step)

        local axis = normalize (cross tangent lastTangent)
        local theta = acos (dot tangent lastTangent)
        local rotation = quat theta axis

        lastTangent = tangent
        lastRot *= rotation
        translate (lastRot as matrix3) location
    )
)


fn testgetPathMatrices spl curve count =
(
    local TMs = getMatricesAlongSplineCurve spl curve count

    for TM in TMs do
        Point transform:TM size:10 wirecolor:green axisTripod:on cross:off
)

testgetPathMatrices $Shape002 1 20

Page 3 / 3