<span style="font-family: 'Courier New', Courier, Monospace; font-size: 12px"><div>I looked into it, it appears no ActiViz wrapper was generated for the double overload.</div>
<div>Most likely other functions which are overloaded for both float and double will have the same issue. I would highly recommend building sections of code which are going to require significant passing of data between managed and unmanaged memory as a C++ DLL and use pinvoke to call the function on the pinned arrays.</div>
<div> </div>
<div>
<div>Mark DeArman</div>
<div>Cascade Acoustic Research</div>
<div>http://www.cascadeacoustic.com</div>
<div>(253) 200-5353</div>
</div>
<div> </div>
<hr align="center" size="2" width="100%" />
<div><span style="font-family: tahoma,arial,sans-serif; font-size: 10pt;"><b>From</b>: "csumushu" <csumushu@126.com><br />
<b>Sent</b>: Wednesday, November 8, 2017 5:23 PM<br />
<b>To</b>: vtkusers@vtk.org<br />
<b>Subject</b>: SPAM-LOW: [vtkusers] How to use vtkMath functions in ActiViz.NET for data of type double?</span>
<div> </div>
Hello, guys and ladies<br />
Is there anybody using ActiViz.NET? I am confused about using vtkMath<br />
functions in ActiViz.NET. Take Distance2BetweenPoints as an example, with<br />
double type data can not get the correct result,but it is OK to use float<br />
type.<br />
<br />
The following code is from<br />
http://lorensen.github.io/VTKExamples/site/CSharp/SimpleOperations/DistanceBetweenPoints/<br />
<http://lorensen.github.io/VTKExamples/site/CSharp/SimpleOperations/DistanceBetweenPoints/><br />
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
using System.Diagnostics;<br />
using Kitware.VTK;<br />
<br />
void DistanceBetweenPoints() {<br />
// Create two points.<br />
double[] p0 = new double[] { 0.0, 0.0, 0.0 };<br />
double[] p1 = new double[] { 1.0, 1.0, 1.0 };<br />
<br />
IntPtr pP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);<br />
IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);<br />
Marshal.Copy(p0, 0, pP0, 3);<br />
Marshal.Copy(p1, 0, pP1, 3);<br />
<br />
// Find the squared distance between the points.<br />
double squaredDistance = vtkMath.Distance2BetweenPoints(pP0, pP1);<br />
<br />
// Take the square root to get the Euclidean distance between the points.<br />
double distance = Math.Sqrt(squaredDistance);<br />
<br />
// Output the results.<br />
Console.WriteLine("SquaredDistance = " + squaredDistance);<br />
Console.WriteLine("Distance = " + distance);<br />
Marshal.FreeHGlobal(pP0);<br />
Marshal.FreeHGlobal(pP1);<br />
}<br />
<br />
The result is SquaredDistance = 3.515625, Distance = 1.875 with double type,<br />
and SquaredDistance = 3, Distance = 1.73205080756888 for float.<br />
<br />
Can anyone tell me where the problem is?<br />
<br />
<br />
<br />
--<br />
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html<br />
_______________________________________________<br />
Powered by www.kitware.com<br />
<br />
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br />
<br />
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br />
<br />
Search the list archives at: http://markmail.org/search/?q=vtkusers<br />
<br />
Follow this link to subscribe/unsubscribe:<br />
http://public.kitware.com/mailman/listinfo/vtkusers<br />
</div></span>