
visualdatatools.com Discussion for DataTank and DataGraph

View previous topic :: View next topic 
Author 
Message 
Adam
Joined: 01 Dec 2006 Posts: 61 Location: Sequim, WA

Posted: Sat Mar 27, 2010 11:05 pm Post subject: creating 3D Surface Coordinates 


Is it possible to create a 3D Surface Coordinates object from a 3D Surface? I'd like to create a 3D Surface Texture by mapping an aerial image to an elevation dataset, which is a triangular mesh/3D Surface. I've been looking at DTSource, but I'm confused about the purpose of the u/v vectors.
My current workaround is to create a 3D Surface Values with one channel of the bitmap, but that limits me to grayscale and is kind of clunky due to some reinterpolation. 

Back to top 


David Site Admin
Joined: 25 Nov 2006 Posts: 1964 Location: Chapel Hill, NC

Posted: Sun Mar 28, 2010 1:34 am Post subject: 


You mean you want to take a surface and map (x,y,z) into something like (x,y). That is (u,v) = (x,y). This would then assume you have a bitmap that will contain the (u,v) locations. Note that (u,v) are coordinates in 2D. I'm not mapping this on [0,1]x[0,1].
So for example the code will define the 2D coordinates on the surface to be (x,y):
Code:  DTSurfaceCoordinates3D Computation(DTSurface3D surf)
{
DTFloatArray points = surf.Points();
int howMany = points.n();
int i;
DTMutableFloatArray U(howMany);
DTMutableFloatArray V(howMany);
for (i=0;i<howMany;i++) {
U(i) = points(0,i);
V(i) = points(1,i);
}
return DTSurfaceCoordinates3D(surf,U,V);
}

If you have a 300x300 bitmap with dx=dy=1, you need the xy range of the surface to be inside the box [0,300]x[0,300], for example hand in a sphere with radius 120 and center (150,150,0). Then attach the grid and bitmap using the "Coordinates and Bitmap" module inside a "3D Surface Texture" variable.
David 

Back to top 


Adam
Joined: 01 Dec 2006 Posts: 61 Location: Sequim, WA

Posted: Sun Mar 28, 2010 2:33 pm Post subject: 


David wrote:  You mean you want to take a surface and map (x,y,z) into something like (x,y). 
I'm glad you figured out what I meant . Yes, that works perfectly, and is just what I was looking for. Thanks! 

Back to top 




You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
