jPCT-AE - a 3d engine for Android => Support => Topic started by: AceGIS on October 23, 2012, 12:29:07 am

Title: Polylines
Post by: AceGIS on October 23, 2012, 12:29:07 am
Hi All,

I'm thinking I may be able to derive polylines from my models? In the snippet below I am assigning multi textures via the polygon manager. Do you think it may be possible to use modulus to create the polylines at equal intervals? Something like : if (vertextHeight.z % 10 = 0), polylineVertexs.append(vertexHeight.x, vertextHeight.y, vertexHeight.z), new Polyline(polylineVertexs) ??

Code: [Select]
for (Object3D obj : models) {
PolygonManager objPolyManager = obj.getPolygonManager();

// for each polygon set texture according to normalised vertex elevations
for (int i = 0; i < objPolyManager.getMaxPolygonID(); i++) {
float u0 = 0, u1 = 0, u2 = 0;

for (int j = 0; j < 3; j++) {
SimpleVector vertexHeight = objPolyManager.getTransformedVertex(i, j);
float normalisedHeight = (vertexHeight.z - MIN_Z)/(MAX_Z - MIN_Z);

if (j == 0) {
u0 = normalisedHeight;
else if (j == 1) {
u1 = normalisedHeight;
else if (j == 2) {
u2 = normalisedHeight;

TextureInfo ti = new TextureInfo(tm.getTextureID("esri_color_scale"), u0, u0, u1, u1, u2, u2);
objPolyManager.setPolygonTexture(i, ti);
Title: Re: Polylines
Post by: EgonOlsen on October 23, 2012, 07:17:16 am
I don't think that this will work very well. Apart from the fact that (vertexHeight.z % 10 = 0) almost never triggers because vertexHeight.z is a float, this will create some garbled line soup IMHO. You might want to skip that %10 condition and simply use every vertex to recreate the triangles as polylines...if that's worth it...
Title: Re: Polylines
Post by: AceGIS on October 28, 2012, 09:59:44 pm
Hi Egon,

No. I'm not trying to create the polygons triangle boundary polylines but rather contour lines. What if I use the transformed vertex height before normalising? Convert the value to an int, then mod 10 = 0?

OR is it possible to have a texture with transparent pixels? Then I could use the transparent pixel for no display and the color pixel for the contour line?

OR any other suggestions?