visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

creating 3D Surface Coordinates

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Getting Started
View previous topic :: View next topic  
Author Message
Adam



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

PostPosted: Sat Mar 27, 2010 11:05 pm    Post subject: creating 3D Surface Coordinates Reply with quote

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
View user's profile Send private message
David
Site Admin


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

PostPosted: Sun Mar 28, 2010 1:34 am    Post subject: Reply with quote

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 x-y 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
View user's profile Send private message Send e-mail
Adam



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

PostPosted: Sun Mar 28, 2010 2:33 pm    Post subject: Reply with quote

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 Smile. Yes, that works perfectly, and is just what I was looking for. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Getting Started All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
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