- Distribute samples on the curve. Let's say *201*
- Define a starting 3x3 matrix (*M*) and store it in an array.
- Iterate over each sample segment, rotating the previous segment *M* by an
axis-angle rotation, where the axis is the cross product of the current
segment with the previous segment and the angle is the angle between the
two segments. Or if you have access to quaternion functions you can use
something like "align". For each iteration append that segment's *M *in he
array. This will give you an array/list of matrices samples along the curve
and with no wild turns.

Let's say you're doing the curve deform on the *Z* axis and you have *201*
 samples, and the curve length is 4 units and you're evaluating the
deformation of a point with coordinates *(1,1,3)* to find out which 2
sample matrices you'll interpolate between to get its curved position:
- Store the point  without *Z* coordinate (1,1,0), let's call it the Local
Coordinate (*LC*).
- Use the point *Z *coordinate (3) to find the relative position on the
curve (U). So 3, in curve with length 4 gives you an U of 3/4, so, U = 0.75.
- You turn the U value into samples indicies by multiplying it by the
number of samples. So 0.75 * 201 =  150.75.
- Pass 150.75 through a floor() and a ceil() two know the two interpolation
samples, sample 150 and sample 151, which bias value is equal to the
fractional part, 0.75. If you have access to matrix SLERP, use that.

Now, how are you solving the Position on a curve with a method that allows
you to get to feed a U, just use the .75 value. If not, you can always
interpolate the position of the samples generated in step one by lerp
(sample150.Pos, Sample 151.Pos, 0.75). It's a linear transition but
depending on the number of samples might not matter.
- Multiply *LC* by the resulting matrix and you have the Local Coordinate
rotated like like it is deformed by the curve. Add the Position on the
curve and you're done.

This is sort of what I used here  https://vimeo.com/220403055 but I used
Sweep SOP to have the matrix samples done for me. Good luck in Maya.

Cheers

On Tue, Aug 22, 2017 at 11:27 PM, Jonathan Moore <jonathan.moo...@gmail.com>
wrote:

> Studying this Entagma approach to recreating C4D's spline wrap deformer
> (very similar to XSI's Deform by Curve) in Houdini might provide some clues
> as to how to create something similar in Maya. I have no experience of
> creating custom tools for Maya but the Houdini custom tool approach might
> spark some inspiration for somebody more experienced in Maya's underlying
> wiring.
>
> http://www.entagma.com/rebuilding-the-c4d-spline-wrap-deformer-in-houdini/
>
>
> On 22 August 2017 at 21:32, Matt Lind <speye...@hotmail.com> wrote:
>
>> The flipping problem is due to a property of curves.
>>
>> A parametric curve's normal always points in the direction of concavity
>> at a
>> given location.  The normal will flip where the curve transitions from
>> concave to convex (and vice versa), such as at the mid-section of an "S"
>> curve.  Tools will often apply a "Frenet" frame which is an added layer of
>> math that walks along the curve and unifies the normal direction by
>> applying
>> local rotations to buffer the flipping, but Maya doesn't appear to be
>> using
>> one.
>>
>> Specifying a linear quantity such as an up vector will not resolve the
>> issue
>> as you need a correction along the flow of the curve, not a fixed point or
>> direction in a linear coordinate space.
>>
>> Matt
>>
>>
>> Date: Tue, 22 Aug 2017 17:25:02 +0200 (CEST)
>> From: Morten Bartholdy <x...@colorshopvfx.dk>
>> Subject: Re: Otish - is there a Maya equivalent of XSI's Deform by
>> Curve?
>> To: "Official Softimage Users Mailing List.
>>
>> I have just tried all the options for World Up Type - they just produce
>> different types of flipping.
>>
>> I will try lattice on curve and see how it goes.
>>
>> MB
>>
>>
>> ------
>> Softimage Mailing List.
>> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com
>> with "unsubscribe" in the subject, and reply to confirm.
>>
>
>
> ------
> Softimage Mailing List.
> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com
> with "unsubscribe" in the subject, and reply to confirm.
>



-- 
------------------------------

Pedro Alpiarça dos Santos


*         probiner.xyz <http://probiner.xyz/> *
------
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to