Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: ChangePointAltitude  (Read 3896 times)
dantra
Community Member
*
Posts: 163


« on: May 03, 2004, 09:47:36 AM »

Hi,

If you put a mesh at a -ve x, setting the low x edge doesn't work, BUT if you add a small number to z, it magically works! Seems there is a floating point error somewhere. I know it sounds strange... but below is the proof:

Code:

for ( int i=0; i<=8; i++ ) {
for ( int j=0; j<=8; j++ ) {
x = -80F+i*10;
z = j*10;
Land2.ChangePointAltitude( x, z, 10F+r.Next(2), true, false, false );
}
}


Produces the incorrect edge as shown here:
http://downloads.sydneh.com/tim/ChangePointAltitude.JPG

However if I change the code to be
Code:
Land2.ChangePointAltitude( x, z+1, 10F+r.Next(2), true, false, false );


The edge is set correctly.


Below is the full code, a modified version of the most basic terrain tutorial:
http://downloads.sydneh.com/tim/Form1.cs.txt

Note that it only applies to -vely place meshes.


And some more screenshots showing the behaviour. Note that my workaround is to just add a small number to z, and the terrain works for all values then (+ve and -ve).
http://downloads.sydneh.com/tim/landincorrect.JPG
http://downloads.sydneh.com/tim/landcorrect.JPG
Logged

Who knows what can be forgotten
SylvainTV
Administrator
Community Member
*****
Posts: 4971


WWW
« Reply #1 on: May 28, 2004, 10:48:55 AM »

Thanks I will look Smiley
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
dantra
Community Member
*
Posts: 163


« Reply #2 on: June 10, 2004, 09:51:17 AM »

Hi, Appologies for the shameless bump Sylvain Smiley

I've discovered that my z+1 "work around" doesn't actually work for larger values. If a patch is not in the offing, perhaps a hint on the scaling error will tide me over Smiley as I'm having trouble reverse engineering it.

As a suggestion it might be nice to be able to access the height points by indexing them unscaled or transposed (ie:0->256/precision), perhaps through another method [only if thats easy to code].

However I think most people would prefer just the existing function, but have it snap to nearest vertex (using world coords).


Regards,
Tim.
Logged

Who knows what can be forgotten
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks