<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi everyone.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I've been using VTK for a bit now, and I've made a few improvements I'd like to contribute to the community. </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Before I do, however, I'd like to know if there is interest in me doing so before I go through the hassles of submission.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">GENERAL PROBLEM STATEMENT  (MOTIVATION)</p>
<p style="margin-top:0;margin-bottom:0">---------------------------------------------------------------</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I have a list of objects that I'd like to transform using a single widget. Widgets take a single vtkProp3D as target. For (multiple) reasons beyond the scope of this discussion, I couldn't use vtkAssembly to target my
 multiple actors. Plus, I wanted each actor to transform according to their local reference frame, not the reference frame of the vtkAssembly.  </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">PROBLEM (1/3)</span><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">------------</span><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">---------</span></p>
<p style="margin-top:0;margin-bottom:0">vtkTransform can take as input another vtkTransform, to which it concatenates its own SRT values,  its output being it the concatenation of the input transform and itself.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">This is useful and allows for multiple scenarios, including this common pattern of parent-child hierarchical chain of transforms, as is shown in this Robot-Arm example. </p>
<p style="margin-top:0;margin-bottom:0"><a href="https://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/TransformPipeline" class="OWAAutoLink" id="LPlnk630370" previewremoved="true">https://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/TransformPipeline</a></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">In the example above, 3 transforms are chained together, and   </p>
<p style="margin-top:0;margin-bottom:0">xform1 --to--> xform2's input ,   xform2's output -- to --> xform3's input.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">xform1 is set as the user transform of the root actor</p>
<p style="margin-top:0;margin-bottom:0">xform2 is set <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">as the user
 transform of the mid actor</span></p>
<p style="margin-top:0;margin-bottom:0">xform3 is set as the user transform of the leaf actor</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">In other words, the *parent's transform* is inherited, and each actor's *local transformation* is controlled by calling the normal functions, such as TranslateX, RotateY, etc, and when concatenated provides the actor's *global
 transform*</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">That's all fine, as long as you want to, or can, control each of the local transform directly.  But what if you'd like to also control the *local transform* via another transformation pipeline? 
 The vtkTransform's input is already taken by the parent transform, were would I plug the local transform's input?</span><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">SOLUTION (1/3) --  Introducing </span><span style="font-size: 12pt;">vtkDualInputTransform</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">-----------------------------------------------<span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">-------------------------</span></span><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">As its name implies, vtkDualInput transform adds a second input (Input2) to the standard vtkTransform.</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">Whereas the vtkTransform's
</span><span style="font-size: 12pt;">output</span><span style="font-size: 12pt;"> was :   GetMatrix() = </span><span style="font-size: 12pt;">[INPUT][MYSELF],  </span><br>
</p>
<p style="margin-top:0;margin-bottom:0">Then vtkDualInputTransform's putput is : GetMatrix() = [INPUT][INPUT2] [MYSELF]</p>
<p style="margin-top:0;margin-bottom:0">(with adaptations wrt Pre-Post multiply flag).</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">In vtkDualInputTransform, both Input1 and Input2 can be muted, so that they are skipped, just as if there was no input connected.  (It's like closing a gate)</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">ADVANTAGES</p>
<p style="margin-top:0;margin-bottom:0">-------------------</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">With the vtkDualInputTransform, you can create complex chains of transforms that allows for direct control of different parts of the transform multiple actors from a single source.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">In my case, Input1 is the parent transform, Input2 is the local transform, and  I leave the internals alone (set to Identity).</p>
<p style="margin-top:0;margin-bottom:0">The result is thus GetMatrix() = [INPUT][INPUT2][IDENTITY]  = <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">[INPUT][INPUT2]</span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Using this pattern, I have 100 actors driven by different pipelines, yet I can affect all of them at once by changing a common transformation pipeline that is plugged into the second input. </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">PROBLEM (2/3)</span><br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
---------------------</p>
<div><br>
</div>
With the vtkDualInputTransform in place, which I could plug into an Actor's UserTransform, I could now effect the global transform using 2 transformation pipelines (its parent tranform, and its local transform).
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">But, what if I wanted to transform my actors by setting affecting their local transforms using another actor as the driver? </p>
<p style="margin-top:0;margin-bottom:0">(why? because a widget targets a prop/actor, and I want the changes to the targetted actor's transformation to propagate down to a transformation pipeline to affect other actors)</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">In other words, I want: </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">widget -> actorA's transform -> input of <span style="font-size: 12pt;">vtkTransform --> input of vtkTransform --> input of vtkTansform --> input of actorB, actorC, actorD (etc)'s UserTransform.</span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">While we can do actorA's GetMatrix() (which is the concat of its input and own pos/ori/scale/origin/etc), there is unfortunately, there is no way to do actor->GetTransform() (since it might get pushed/popped from the
 stack, it might not always be valid, might disappear etc).   So how do I drive a transform pipeline from an actor?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">SOLUTION (2/3) --  Introducing </span><span style="font-size: 12pt;">vtkProp3DTransformAdapter</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">-------------------------------------------------------------------------------</span><br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">This is another derivative of vtkTransform. It has a SetProp3D method, which serves the same purpose as the vtkTransform's input.</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">(in fact, vtkProp3DTransformAdapter's input is not used, and a warning is issued if it is)</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">In vtkProp3DTransformAdapter, in the InternalUpdate method, instead of calling Input->GetMatrix(), we simply call prop3D->GetMatrix(), which ensures is always valid.</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">PROBLEM (3/3)</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">--------------------</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">Finally, there's a catch: I want to affect multiple actors's global transform but control the local transform, but there's a catch when doing [INPUT][INPUT2].</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"><br>
</span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;">Indeed, that concatenation is (roughly) the equivalent of: </span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
Result = [IN_scl] x [IN_ori] x [IN_trs] x [IN2_scl] x [IN2_ori] x [IN2_trs].</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
In other words, by the time we multiply IN2, IN's translation is already considered, so scale and rotation of the 2nd input will have their transformation center set to IN's translation, which a problem.</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
What I want instead is consider the concatenation of the scale, orientation, and transformation :</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
Result = [IN_scl] x [IN2_scl]   x   <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">[IN_ori] x [IN2_ori]   x   </span>[IN_trs]
 x [IN2_trs].</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<div><br>
</div>
<div>SOLUTION (3/3) -- Introducing vtkMutableTransform</div>
<div>---------------------------------------------------------------------</div>
<div><br>
</div>
<div>Unfortunately, I did not find a proper name for this one, as "mutable" can imply "changeable".   But I meant it to mean that you could "mute" portions of the transform. </div>
<div><br>
</div>
<div>The goal of this derived class is that you feed it a transform, and out comes the same transform without the muted portions. For example, the transform's output is the same as the input, with scaling, orientation, or translation stripped out. </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>CONCLUSION: </div>
<div>--------------------</div>
<div><br>
</div>
<div>Using the proper combination of the 3 vtkTransform derivatives described above, and chained together in the proper order, you can make a transformation graph that is fully automated and controllable from any point or any source in the transform pipeline.</div>
<div><br>
</div>
<div><br>
</div>
<p></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="font-size: 12pt;"></span><span style="font-size: 12pt;"> </span></p>
<div>Let me know if there is interest in me submitting these 3 classes.</div>
<div><br>
</div>
<div>Regards</div>
<div>Patrick Bergeron</div>
<div><br>
</div>
<div><br>
</div>
<p></p>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p></p>
</div>
</div>
</div>
</body>
</html>