[vtkusers] vtkAmoebaMinimizer

David Gobbi david.gobbi at gmail.com
Thu Jul 21 11:33:01 EDT 2011


Hi Laurent,

The cost function is an old-style C callback with a "void *" argument
that can be used to pass extra data to it.  So usually you would do
this:

amoeba->SetFunction(costfunction, data);

Then, in the cost function, you can cast the "data" to its original
pointer type.  If you are already using the void pointer for the amoeba
object, then you can make a new mini-struct that contains pointers
to both the amoeba object and the data object, and pass that as the
void pointer argument.

 - David


On Wed, Jul 20, 2011 at 8:48 AM, Laurent <l.paul at uclouvain.be> wrote:
> Hi Kevin,
>
> No, the mean normal is not enough. It was my first approach, but I need to
> minimize the angle difference between each cells normal and a vector.
> Ameoba does the job, it is perfect.
> My concern was to provide it with the data.
> To do so, I had to temporarily write out the data in a file, read it in the
> Cost Function called by the minimizer and compute the function value. It
> works but it is not elegant...
> Is there a way to pass data without writing these in a file?
>
> Laurent.
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/vtkAmoebaMinimizer-tp4599094p4616159.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list