Question about method in Scalismo+Scala

7 views
Skip to first unread message

Maia R.

unread,
Jan 15, 2021, 1:44:51 PM1/15/21
to scalismo
Hi,
In this tutorial:
targetMesh is used in the function attributeCorrespondences() but is not defined as its parameter: how can be it be possible in Scala.
This is working within a object App but not in a separate case class if I want to include this function as a class method ?
Thanks,
Maia


Marcel Luethi

unread,
Jan 16, 2021, 10:38:57 AM1/16/21
to Maia R., scalismo
Hi Maia

In this example, targetMesh was just defined to be a member of the object, in which also the method attributeCorrespondences is defined. You could do the same with a class. Just let the target mesh be a constructor argument (e.g. class MyClass(val targetMesh: TriangleMesh[_3D])
Another possibility would have been to pass the mesh explicitly to the method attributeCorrespondences. Which one is better depends a bit on the context.

Best regards,

Marcel

--
You received this message because you are subscribed to the Google Groups "scalismo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalismo+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalismo/b6ec2a49-c52f-4dcb-a4e3-cca864cd0ea8n%40googlegroups.com.

V R

unread,
Jan 16, 2021, 3:17:53 PM1/16/21
to Marcel Luethi, scalismo
Ok, thanks! 

V R

unread,
Jan 16, 2021, 3:19:12 PM1/16/21
to Marcel Luethi, scalismo
Hi Marcel,
The second option works for me.
Thanks a lot !
Best regards

Le sam. 16 janv. 2021, à 10 h 38, Marcel Luethi <marcel...@gmail.com> a écrit :
Reply all
Reply to author
Forward
0 new messages