Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - janineh

#1
Support / Re: VertexController question
December 28, 2007, 10:27:41 AM
That produced better results, thanks.
I'm now getting (from first iteration of the outside loop):
polyID:0
polyID:1
polyID:6
polyID:7
polyID:8

I know about the 0 instead of i, it was a debug measure to try and get it to work!  ;)

Thank you for making the change, especially at this time of year!
Seasons Greetings, and I hope you have a Happy New Year.

Janine
#2
Support / Re: VertexController question
December 27, 2007, 05:09:51 PM
I initially used 4 for the max-id-number as I thought there would be only 2 or 3 polygons with the same vertex.
I've upped it to 20 and I still get the same result.

Here's my code in case it helps:


int[] polyIDs;
   
SimpleVector[] srcMesh=this.getSourceMesh();
int size=this.getMeshSize();
               
for (int i=0; i<size; i++)
{
     // Get all polygons that share that vertex
     polyIDs = this.getPolygonIDs(0, 20);
   
     for (int j=0; j<polyIDs.length; j++)
     {
          System.out.println("polyID:" + polyIDs[j]);
     }
}



This is what I get printed out:
polyID:0
polyID:0
polyID:0
polyID:0
polyID:0
polyID:0
polyID:0
polyID:0
#3
Support / VertexController question
December 27, 2007, 01:12:36 PM

I've been playing around with the PolygonManager and GenericVertexController to try and determine adjacent polygons in the same plane to a 'selected' polygon.

Looking at the JavaDoc, it seems that the GenericVertexController.getPolygonIDs function should
'Returns the polygon IDs of the polygons that are using the vertex "number".'

However, I don't understand where I would get the 'vertex number' from - just plugging in 0,1,2, random number gets me an array of length 1 with the value of 0 in the array (i.e. a[0]=0).

This doesn't make much sense as my object is a cube, so each polygon vertex should have at least 3 polygons attached to it.

Am I missing something here?

Many thanks,
Janine
#4
Support / Re: Select a side?
December 18, 2007, 12:34:43 PM
Thank you for the explanation, I'll try it as you've suggested.
#5
Support / Re: Select a side?
December 14, 2007, 05:45:19 PM
I've been playing about with PolygonManager and GenericVertexController and have a couple of questions.

I've set up a very simple class the extends GenericVertexController:

public class TestVertexController extends GenericVertexController {

     TestVertexController() {
     }

     public void apply() {
       SimpleVector[] srcMesh=this.getSourceMesh();

       int size=this.getMeshSize();

       for (int i=0; i<size; i++) {
       System.out.println("A" + i + ": (" + srcMesh[i].x + ", " + srcMesh[i].y + ", " + srcMesh[i].z +")");
       
       }
     }
}


I have also put code into the mouse click event to print out vertex info from the PolygonManager:

SimpleVector td  = Interact2D.reproject2D3D(theCamera,frameBuffer,mousePosition.x,mousePosition.y);
int[] res = Interact2D.pickPolygon(theWorld.getVisibilityList(), td, Interact2D.EXCLUDE_NOT_SELECTABLE);

Object3D obj = theWorld.getObject(Interact2D.getObjectID(res));
PolygonManager polyManager = obj.getPolygonManager();
           
SimpleVector v0 = polyManager.getTransformedVertex(res[1], 0);
SimpleVector v1 = polyManager.getTransformedVertex(res[1], 1);
SimpleVector v2 = polyManager.getTransformedVertex(res[1], 2);
                       
System.out.println("V0: (" + v0.x + ", " + v0.y + ", " + v0.z + ")");
System.out.println("V1: (" + v1.x + ", " + v1.y + ", " + v1.z + ")");
System.out.println("V2: (" + v2.x + ", " + v2.y + ", " + v2.z + ")");


When I run the applet, and click on one polygon I get the following:

A0: (2.0, 2.0000002, 2.0000002)
A1: (2.0, 2.0000002, -1.9999996)
A2: (-2.0, 2.0000002, -1.9999996)
A3: (-2.0, 2.0000002, 2.0000002)
A4: (-2.0, -1.9999996, -1.9999998)
A5: (-2.0, -1.9999999, 2.0000002)
A6: (2.0, -1.9999996, -1.9999998)
A7: (1.999998, -2.0000017, 2.0000002)

V0: (2.0000002, 2.0000002, -1.9999999)
V1: (-1.9999998, -1.9999996, -2.0)
V2: (-1.9999998, 2.0000002, -1.9999999)


The problem is that the numbers don't exactly match - is this a rounding problem, or simply a System.out.println problem?

If I did V0.equals(A1) (assuming they were SimpleVector variables) would it return true?
(I know I could write code to compare and find out, but I haven't worked out how to do that yet and it's 4.30pm on Friday evening...)

Many Thanks,
Janine

#6
Support / Re: Select a side?
December 13, 2007, 11:36:48 AM
I thought that might be the case.

Can you point me in the direction of any examples of using vertex & polygon info from the GenericVertexController and the PolygonManager?

As I said, I'm new at this, and would like to see some example code to try and work out what I'm doing  ;)
#7
Support / Select a side?
December 12, 2007, 06:03:27 PM
Hi,

I'm new to 3D and jPCT, and I hope this isn't a really stupid question.

Is is possible to use the mouse to 'select' a side of an object?

For example, a Primitive box has the texture of one side changed when that side is clicked on.

I can use Interact2D functions to get the PolygonID and use PolygonManager.setPolygonTexture to 'select' the polygon I clicked, but how can I also select the adjoining polygons on the same 'face' of the box?

Many thanks,
Janine