From: SAK <sa...@ge...> - 2005-05-13 08:11:25
|
Thanks for a very prompt reply. I could do this as u mentioned. here is the sample i have done com.xerox.VTM.engine.LongPoint v1 =new com.xerox.VTM.engine.LongPoint(100,100); com.xerox.VTM.engine.LongPoint v2 = new com.xerox.VTM.engine.LongPoint(110,110); com.xerox.VTM.engine.LongPoint v3 =new com.xerox.VTM.engine.LongPoint(210,15); com.xerox.VTM.engine.LongPoint v4 = new com.xerox.VTM.engine.LongPoint(202,512); com.xerox.VTM.engine.LongPoint v5 =new com.xerox.VTM.engine.LongPoint(111,112); LongPoint[] vert = {v1, v2, v3, v4, v5}; Glyph glp = new VPolygon(vert, java.awt.Color.RED); vsm.addGlyph(glp,"plglayer"); I wish to do something like this com.xerox.VTM.engine.LongPoint[] pvertic = new com.xerox.VTM.engine.LongPoint[transcoord.length]; for(int k=0; k< transcoord.length;k++){ String[] ttc = transcoord[k].split(","); System.out.println(transcoord[k]); gcoordX[j][k]= Double.parseDouble(ttc[0]); //int pinx = (int)(-gcoordX[j][k]); //System.out.println("x"+pinx); gcoordY[j][k]= Double.parseDouble(ttc[1]); //System.out.println(gcoordY[j][k]); int piny = (int)(-gcoordY[j][k]); System.out.println("y"+piny); long lpx = -(long)Double.parseDouble(ttc[0]); long lpy = -(long)Double.parseDouble(ttc[1]); pvertic[k] =new com.xerox.VTM.engine.LongPoint(lpx,lpy); Glyph glop= new VPolygon(pvertic, java.awt.Color.BLACK); I have tried doing something like this by understanding your source code! but unfortunately i am not sucessful, could you please help me with this! why my code is wrong! Thanks in advance cheers SAK On Fri, 2005-05-13 at 09:55, Emmanuel Pietriga wrote: > SAK wrote: > > I find it difficult to draw a list or an Array of VPolygons using > > longpoints. Earlier i was successful in drawing single polygons, but if > > i wish to draw a list of polygons / or an array of polygons i am not > > successful in doing it. If nay one of you have implemented it or could > > give me an example to store an array of LongPoints, it would be great! > > You seem to have succeeded in drawing a single polygon, so I suppose you > know how to instantiate one VPolygon by passing it an array of > LongPoint[] (*), which define its vertex coordinates (all other > geometrical data such as the centroid is computed automatically from > this list). > > (*) if not, let me know and I'll give you an example. > > Now, it looks like what you want to do is draw several polygons. I'm > probably missing something, but why don't you just instantiate these > other polygons using the VPolygon constructor several times and adding > them to the virtual space? Here's an example instantiating several > polygons from an array of abstract polygon definitions: > > > LongPoint[][] polygonsToCreate = { > {new LongPoint(10,10), new LongPoint(20,20), new LongPoint(10,20)}, > {new LongPoint(0,0), new LongPoint(10,0), new LongPoint(10,10), new > LongPoint(0,10)}, > {new LongPoint(-50,-100), new LongPoint(100,0), new > LongPoint(30,-145), new LongPoint(70,-180)} > }; > > for (int i=0;i<polygonsToCreate.length;i++){ > vsm.addGlyph(new VPolygon(polygonsToCreate[i], Color.white), "foo"); > } > > > // where foo is the name of the virtual space in which you want to put > the polygons > > > > Describing more precisely what you want to achieve will help us assist > you and provide you with code examples. > > > -- > Emmanuel Pietriga > INRIA Futurs - Projet In Situ tel : +33 1 69 15 34 66 > Bat 490, Université Paris-Sud fax : +33 1 69 15 65 86 > 91405 ORSAY Cedex FRANCE http://www.lri.fr/~pietriga > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click > _______________________________________________ > zvtm-devel mailing list > zvt...@li... > https://lists.sourceforge.net/lists/listinfo/zvtm-devel > |