<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Bill, Elvis,</div><div class="gmail_default" style="font-size:small"> Elvis, personally I wouldn't like to see the homogenisation of the examples by doing what you propose.</div><div class="gmail_default" style="font-size:small">The reasons are:</div><div class="gmail_default" style="font-size:small">1) One of the advantages of the examples is seeing the different approaches used by the contributors.</div><div class="gmail_default" style="font-size:small">2) It may dissuade contributors by implicitly forcing them to use a particular approach.</div><div class="gmail_default" style="font-size:small">3) One of the really useful things in the example is the different ways VTK is used.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To me it matters little whether:</div><div class="gmail_default" style="font-size:small">auto actor = vtkSmartPointer<vtkActor>::<wbr>New();<br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default" style="display:inline"></div>vtkSmartPointer<vtkActor> actor =<br> vtkSmartPointer<vtkActor>::<wbr>New();<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">or whether "ren/renWin" is used instead of "renderer" or "rendererWindow" in the examples.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Of more importance are explanatory notes in the examples.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Bill, I see you are using vtkNamedColors. This example shows what other things you can do with this class:</div><div class="gmail_default"><a href="https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/NamedColors/">https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/NamedColors/</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">For example, assign colors by name:</div><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">renderer</span><span class="gmail-o" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">-></span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">SetBackground</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">(</span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">namedColors</span><span class="gmail-o" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">-></span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">GetColor3d</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">(</span><span class="gmail-s" style="box-sizing:inherit;color:rgb(13,144,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">"SteelBlue"</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">).</span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">GetData</span><div class="gmail_default"><span style="background-color:rgba(238,238,238,0.498);color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre">());</span></div><div class="gmail_default"><span style="background-color:rgba(238,238,238,0.498);color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre"></span>Create your own named color (in this case a red with an alpha of 0.5):</div><div class="gmail_default"><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">namedColors</span><span class="gmail-o" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">-></span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">GetColor</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">(</span><span class="gmail-s" style="box-sizing:inherit;color:rgb(13,144,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">"Red"</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">,</span><span style="color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)"> </span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">rgba</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">);</span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)"><br></span></div><div class="gmail_default"><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">rgba</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">[</span><span class="gmail-mi" style="box-sizing:inherit;color:rgb(231,76,60);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">3</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">]</span><span style="color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)"> </span><span class="gmail-o" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">=</span><span style="color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)"> </span><span class="gmail-mf" style="box-sizing:inherit;color:rgb(231,76,60);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">0.5</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">;</span><span style="color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">
</span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">namedColors</span><span class="gmail-o" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">-></span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">SetColor</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">(</span><span class="gmail-s" style="box-sizing:inherit;color:rgb(13,144,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">"My Red"</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">,</span><span style="color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)"> </span><span class="gmail-n" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">rgba</span><span class="gmail-p" style="box-sizing:inherit;color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">);</span><span style="color:rgb(55,71,79);font-family:"Roboto Mono","Courier New",Courier,monospace;font-size:13.6px;white-space:pre;background-color:rgba(238,238,238,0.498)">
<br></span></div><div class="gmail_default"> </div><div class="gmail_default" style="font-size:small">Regards</div><div class="gmail_default" style="font-size:small"> Andrew</div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>---------- Forwarded message ----------<br>From: Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>To: Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>><br>Cc: vtkdev <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>Bcc: <br>Date: Thu, 22 Jun 2017 13:32:55 -0400<br>Subject: Re: [vtk-developers] vtkNew in examples (or auto?)<br>Let's leave them as is for now. I want to make sure I understand this.<br>
<br>
<br>
On Thu, Jun 22, 2017 at 1:13 PM, Elvis Stansvik<br>
<<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
> 2017-06-22 19:09 GMT+02:00 Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>>:<br>
>> I'm not sure what you mean by auto-fying<br>
><br>
> Sorry, I should have been clearer. What I mean is changing declarations such as<br>
><br>
> <div class="gmail_default" style="font-size:small;display:inline"></div>vtkSmartPointer<vtkActor> actor =<br>
> vtkSmartPointer<vtkActor>::<wbr>New();<br>
><br>
> into<br>
><br>
> auto actor = vtkSmartPointer<vtkActor>::<wbr>New();<br>
><br>
> I think it would cut down on the number of lines in many examples, and<br>
> make them more readable. (This would only be done in places where the<br>
> type of the variable is still clear from the declaration.)<br>
><br>
> Elvis<br>
><br>
>><br>
>><br>
>><br>
>> On Thu, Jun 22, 2017 at 1:07 PM, Elvis Stansvik<br>
>> <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
>>> 2017-06-22 19:01 GMT+02:00 Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>>:<br>
>>>> I prefer vtkSmartPointer because it can be used like any other vtk<br>
>>>> pointer. No need for a GetPointer() is some cases. The example writer<br>
>>>> is free to use vtkSmartPointer or vtkNew. But I would leave them as<br>
>>>> there are.<br>
>>><br>
>>> Right, that's a valid point. But how about auto-fying the<br>
>>> declarations? (but keep using vtkSmartPointer)<br>
>>><br>
>>> My motivation is that when reading an example, I'm often squinting to<br>
>>> find the variable names in the declarations, wedged in there somewhere<br>
>>> between all those type names and angle brackets. Especially as the<br>
>>> lines are often broken due to running long.<br>
>>><br>
>>>><br>
>>>><br>
>>>> Other cleanup's sound great. I've also started using vtkNamedColors<br>
>>>> instead of setting float values.<br>
>>><br>
>>> Great.<br>
>>><br>
>>> Elvis<br>
>>><br>
>>>><br>
>>>> On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik<br>
>>>> <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
>>>>> Hi all,<br>
>>>>><br>
>>>>> How about a refactor of the examples to use vtkNew instead of<br>
>>>>> vtkSmartPointer (where it makes sense)?<br>
>>>>><br>
>>>>> E.g.<br>
>>>>><br>
>>>>> vtkNew<vtkActor> actor;<br>
>>>>> actor->SetMapper(mapper);<br>
>>>>><br>
>>>>> vtkNew<vtkRenderer> renderer;<br>
>>>>> renderer->AddActor(actor);<br>
>>>>><br>
>>>>> instead of<br>
>>>>><br>
>>>>> vtkSmartPointer<vtkActor> actor =<br>
>>>>> vtkSmartPointer<vtkActor>::<wbr>New();<br>
>>>>> actor->SetMapper(mapper);<br>
>>>>><br>
>>>>> vtkSmartPointer<vtkRenderer> renderer =<br>
>>>>> vtkSmartPointer<vtkRenderer>::<wbr>New();<br>
>>>>> renderer->AddActor(actor);<br>
>>>>><br>
>>>>> I think it would help with the readability of the examples. Or are<br>
>>>>> there other reasons for the prevalent use of vtkSmartPointer?<br>
>>>>><br>
>>>>> Another option would be to use auto, e.g.<br>
>>>>><br>
>>>>> auto actor = vtkSmartPointer<vtkActor>::<wbr>New();<br>
>>>>><br>
>>>>> Also, would anyone mind if I did a little naming cleanup, mostly<br>
>>>>> things like "renwin" -> "window" and "iren" -> "interactor"? Those<br>
>>>>> abbreviations are not that bad, but I think it's better in examples to<br>
>>>>> spell out the variables in proper English.<br>
>>>>><br>
>>>>> If there are no objections, I could try to prepare an MR when time<br>
>>>>> permits. If so, vtkNew, or auto?<br>
>>>>><br>
>>>>> Elvis<br>
>>>>> ______________________________<wbr>_________________<br>
>>>>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>>>>><br>
>>>>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>>>>><br>
>>>>> Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
>>>>><br>
>>>>> Follow this link to subscribe/unsubscribe:<br>
>>>>> <a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtk-<wbr>developers</a><br>
>>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> Unpaid intern in BillsBasement at noware dot com<br>
>><br>
>><br>
>><br>
>> --<br>
>> Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
<br></blockquote></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature">___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________</div>
</div></div>