Results 1 to 1 of 1
- 12-26-2009, 10:55 PM #1
Member
- Join Date
- Aug 2009
- Location
- Richmond, Canada
- Posts
- 15
- Rep Power
- 0
Relationship between 3D .obj file "v values" and on screen 2D coordinate?
I posted my question at javagaming
but received no answers yet.
Just reposted here and have a try. It's basically a Java3D question.
I know this is a Java2D forum, but still want to try my luck.
Simple .obj specification can be googled as
Code:
v x y z
The vertex command, this specifies a vertex by its three coordinates. The vertex is implicitly named by the order it is found in the file. For example, the first vertex in the file is referenced as '1', the second as '2' and so on. None of the vertex commands actually specify any geometry, they are just points in space.
I just want to know, if I created a on/off screen canvas of size 640*480 on my computer screen, what is the relationship between
"v values" of the.obj files and the exact values on the on/off screen canvas Huh
Or, there is no relationship between this two at all?
In my case, my .obj file looks like:
Code:
g main
# 75972 vertices.
v -58.1117 -49.4189 -12.242
v -58.0527 -50.0355 -11.9883
v -58.1128 -50.6568 -11.8222
v -58.1629 -51.2563 -11.7768
v -58.2183 -51.8611 -11.7323
v -58.2231 -52.4784 -11.7214
v -58.259 -53.0993 -11.7188
v -58.3331 -53.7061 -11.7407
v -58.3663 -54.309 -11.7328
v -58.3955 -54.9136 -11.7015
v -58.4142 -55.526 -11.6696
v -58.4299 -56.1264 -11.6939
v -58.427 -56.7551 -11.8301
v -58.4213 -57.3728 -12.0565
v -58.8783 -29.3341 -12.3035
v -58.8634 -29.9544 -12.0902
v -58.8288 -30.5471 -11.949
v -58.7427 -31.1332 -11.886
v -58.6354 -31.7285 -11.9012
v -58.5571 -32.331 -11.9593
...
v 55.3262 -54.4387 -11.2943
v 55.3417 -55.068 -11.3683
v 55.3343 -55.6911 -11.5067
v 55.3041 -56.3406 -11.6606
mtllib /.../filename.mtl
usemtl default
vt 0 0.198847 0.0
vt 0 0.195965 0.0
vt 0 0.193084 0.0
vt 0 0.190202 0.0
vt 0 0.18732 0.0
vt 0 0.184438 0.0
vt 0 0.181556 0.0
vt 0 0.178674 0.0
...
I loaded the .obj file like:
Code:
int flags = ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY ; // | ObjectFile.RESIZE;
ObjectFile f = new ObjectFile(flags, 0.0f);
m_S = null;
try {
m_S = f.load(fname);
} catch (FileNotFoundException e)
{
...
}
m_BGFace = m_S.getSceneGroup();
m_Object3d = (Shape3D)m_BGFace.getChild(0);
Bounds m_ObjBounds = m_Object3d.getBounds();
Now, as you might have noticed, I intended not to use the configuration "ObjectFile.RESIZE; " to avoid automatically resize when loading this .obj file.
Now, m_ObjBounds does show the bounds of this object's "v value list". (well, you may look on the v value list as a point list and calculate its boundary, Java3D Bounds and BoundingBox are pretty useful here )
However, I still can't find any relationship between this "loaded v values" and "on/off screen pixel coordinates".
For sure, there must be some relationship between this two, because Java3D must be able to load data from .obj files and display them automatically on the screen by Java3D itself. isn't it?
So, can anybody tell me, what is the relationship between .obj files' "loaded v values" and "on/off screen pixel coordinates" ??
Best Regards
JIA PeiWelcome to Vision Open
http://www.visionopen.com
Similar Threads
-
Getting access denied error while importing file using input type="file" with IE7
By sarang1 in forum Advanced JavaReplies: 6Last Post: 02-10-2011, 09:55 AM -
"Find" screen
By glhansen in forum New To JavaReplies: 2Last Post: 03-12-2009, 06:06 PM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
Exception in thread "Thread-22" java.lang.NoClassDefFoundEthen screen just sits there
By bnh14 in forum Java AppletsReplies: 3Last Post: 11-06-2008, 04:24 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks