Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  .obj -- How to obtain and revise the vertices's coordinates?  (Read 2303 times)
0 Members and 1 Guest are viewing this topic.
Offline jiapei100

Junior Devvie

« Posted 2009-10-07 23:52:34 »

Java3d is using GeometryInfo to obtain the geometric information of the loaded .obj files.

Let's suppose I've already obtained the Shape3D obj3d,

I can use
GeometryInfo gi = new GeometryInfo(  (GeometryArray)obj3d.getGeometry() );
and then
Point3f[] coords = gi.getCoordinates();

to obtain all the coordinates relative to triangles' vertexes (loads of duplicates), but it seems we an never obtain the used vertexes directly.

For instance, in my case, I'm trying to load a huge .obj file. There are totally 75,972 vertexes, but 150,958 triangles.

The above method "Point3f[] coords = gi.getCoordinates();" will give me 150,958*3(3 vertexes for each triangle)=452,874 vertexes. I really don't need it I think. What I need is just those 75,972 vertexes' coordinates. How can I obtain these coordinates please?

Seriously urgently. Thank you very much in advance.

Best Regards

Welcome to Vision Open
Offline jiapei100

Junior Devvie

« Reply #1 - Posted 2009-10-12 06:37:35 »

It's pretty strange.

If I only do:

GeometryInfo gi = new GeometryInfo( head );
IndexedGeometryArray iga = gi.getIndexedGeometryArray(true);
Point3f[] coords = gi.getCoordinates();
Object[] texcoords = gi.getTextureCoordinates(0);

As you can see, I didn't use "IndexedGeometryArray iga" at all, but it seems "gi.getIndexedGeometryArray(true)" not only assign to "iga" but change "gi" itself !!

Now,  coords has 75,970 elements while texcoords  has 75,969 elements.

There should be totally 75,972 coordinates with 75,972 textures spreading over these 75,972 points.

To my most strange:

gi.setTextureCoordinates(0, texVec);

works, where shapeVec and texVec are two vectors of 75,972 elements.

That's to say, getCoordinates() returns a vector of 75,970, while setCoordinates() works for a vecto of 75,972.

Seriously don't know how Java3D performed.
And it's seriously confusing why
IndexedGeometryArray iga = gi.getIndexedGeometryArray(true);
changes gi Huh?



Welcome to Vision Open
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

numerical (74 views)
2017-02-21 07:32:16

numerical (75 views)
2017-02-21 07:31:46

theagentd (179 views)
2017-02-18 13:42:33

theagentd (182 views)
2017-02-18 13:35:16

h.pernpeintner (1345 views)
2017-01-24 22:39:11

h.pernpeintner (1333 views)
2017-01-24 22:38:32

Galdo (1894 views)
2017-01-12 13:44:09

Archive (1983 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2519 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2310 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!