POV-Ray : Newsgroups : povray.newusers : a simple surface : Re: a simple surface Server Time
30 Jul 2024 16:19:42 EDT (-0400)
  Re: a simple surface  
From: Phil Cook
Date: 25 Jun 2004 11:07:39
Message: <opr95oawtqefp2ch@news.povray.org>
And lo on Fri, 25 Jun 2004 08:52:12 -0500, Christopher James Huff  
<cja### [at] earthlinknet> did spake, saying:

> In article <opr93snpswefp2ch@news.povray.org>,
>  "Phil Cook" <phi### [at] nospamdeckingdealscouk> wrote:
>
>> Uses boxes rather than points and might be slow with a *lot* of data  
>> (this
>> took 26 sec on my computer, 76800 objects) but I hope it helps.
>
> It would be far faster, more space efficient, and probably better
> looking to use a mesh instead.

I'm not sure how you would do that if you tried to join them in a row you  
could end up with a triangle{<0,0,4>,<0,0,5>,<0,3,6>} even if you use each  
point separately and created two flat points each side as  
triangle{<-0.5,0,0>,<0,1,0>[data],<0.5,0,0>} you would still end up with  
distinct rows unless you create additional triangles to bridge the rows  
and I still think it would look a bit granular.

I've probably missed something so I would be curious as to how you would  
do it?

Okay saying that here's how I would do it:

//code
#fopen MyFile "superficie.dat" read
#while (defined(MyFile))
#read (MyFile,LastX, LastZ, DitchY)
#end

#declare LastX=LastX+1;
#declare LastZ=LastZ+1;

camera{
location <LastX/2,300,300>
look_at  <LastX/2,0,LastZ/2>
}

light_source{<LastX/2,100,LastZ/2> rgb 1 shadowless}

#declare MyArray= array[LastX][LastZ];

#fopen MyFile "superficie.dat" read
#while (defined(MyFile))
#read (MyFile,MyX, MyZ, MyY)
#declare MyArray[MyX][MyZ]=<MyX,MyY,MyZ>;
#end

#declare i=0;
#declare j=0;

mesh{

#while(j<LastZ)

#while(i<LastX)

triangle{
<MyArray[i][j].x-0.5,0,MyArray[i][j].z>,MyArray[i][j],<MyArray[i][j].x+0.5,0,MyArray[i][j].z>
}
#declare i=i+1;
#end
#declare j=j+1;
#declare i=0;
#end
pigment{green 1}
}

plane{y,0 pigment{rgb 1}}
//end code

runs in 18 sec on mine, but I don't think it looks as good as the box or  
patch version.

--
Phil Cook

-- 
All thoughts and comments are my own unless otherwise stated and I am  
happy to be proven wrong.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.