![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
There is a big mistake in the new version!!! I am fixing it now.
-Shay
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Allright, corrected my mistake. Corrected source posted to pbs-f. That will
teach me not to PoV at work!
-Shay
"Shay" <shi### [at] houston rr com> wrote in message
news:3c856818@news.povray.org...
>
> There is a big mistake in the new version!!! I am fixing it now.
>
> -Shay
>
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi Shay,
Thank you once again for the various versions of the mesh-smoothing code!
I'll try to implement it today!
> height-field only optimised method for finding the triangle areas
> ....finds the weighted normal
I'm not sure what this is about. Maybe I can find out by reading your code.
Will I be limited in the way I can bend / move the vertices around?
> That will teach me not to PoV at work!
Hmm you know better than me, but if you had the necessary time and decided
to PoV, I surely don't mind! Your new version was done quicker than it would
otherwise have been. :o)
Best regards,
Hugo
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
It is with pleasure I can announce that the normal-smoothing routine in my
macro now works, thanks to Shay! So far I only implemented the idea from
version 1 ... it was simpler to begin with, so I will add the weighted
normals as soon as possible.
I will also add a few more features and then post some examples of results..
This won't take so long, I think. :o)
Regards,
Hugo
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hugo <hua### [at] post3 tele dk> wrote in message
news:3c8626aa$1@news.povray.org...
> It is with pleasure I can announce that the normal-smoothing routine in my
> macro now works
Excellent. Like I said, can't wait to use it.
Regarding the heightfield only method for finding the area of the triangle:
The formula I used was Area = (Side_1_Length * Side_2_Length *
sin(Included_Angle))/2
A 100x100 array of vertices would require finding 39,204 angles!!
With a heightfield, however, the verices are only moved up and down, so the
angle at any corner of a square will always be pi/2 radians. The sin of pi/2
radians is 1, so the sin(Included_Angle) part can be dropped!!
For a mesh with different angles at the corners of a "square," an angle must
be found for each triangle. There are two ways I can think of to do this.
Both are slow, but one should shurely be faster than the other.
The first way is to use PoV's vangle() macro. This macro requires vectors as
inputs, so in addition to finding the lengths of the square sides, you will
also have to find the vectors.
The second and probably faster way is to use your own math. In addition to
the lengths of the sides of the square, you will need to find the lengths of
the [/] and [\] diagonals. You can then find the angle with something like
this:
#declare Included_Angle = acos ((Side_1_Length^2 + Side_2_Length^2 -
Diagonal^2) / (2 * Side_1_Length * Side_2_Length));
(above is NOT TESTED! And I am using my WORK brain.)
-Shay
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Wed, 6 Mar 2002 09:11:10 -0600, "Shay" <sah### [at] simcoparts com> wrote:
> For a mesh with different angles at the corners of a "square," an angle must
> be found for each triangle. There are two ways I can think of to do this.
> Both are slow, but one should shurely be faster than the other.
universal formula for area of triangle:
S=sqrt(p*(p-a)*(p-b)*(p-c))
where a,b,c are lengths of edges and p is half of perimeter = (a+b+c)/2
as you see you don't need angle at all
ABX
--
disc{z,-z 5#macro O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
e=e-1;#end#local e=26;pigment{#local g=function(_){ceil(_)-_}function#local//X
k=function{pattern{object{sphere_sweep{linear_spline 13#while(e>0)<O(),O()//AB
>.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient 1}}//POV35
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
wrote:
> universal formula for area of triangle:
btw: if you are interested in background theory then
http://mathworld.wolfram.com/HeronsFormula.html
ABX
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Thank you again, ABX. It seems that you are always waiting in a dark corner
ready to jump out with a formula the way Ken is with a link.
I never went to college, so most of the math I know is self tought. This
leaves BIG holes in my math knowledge.
The formula you supplied will help a lot, because I will henceforth be
adding a "weighted" switch to all of my vertex normalizing macros.
-Shay
news:2tcc8uk708tgec598p843g17v5gf6ajjld@4ax.com...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Thanks for the formulas and explanations, but I am not sure how to implement
them.. I like math too (more than I did in school!) but I'm not educated
enough to understand what ABX wrote.. I'd very much like to have the best
smoothing algoritm in my program.. If Shay codes it for personal use, maybe
I will get a copy too and some insight. :o) At the moment I'm
concentrating on another part of my macros that needs to be written before
the overall results will look good enough to open your eyes. ;o)
Regards,
Hugo
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hugo <hua### [at] post3 tele dk> wrote in message
news:3c864b48$1@news.povray.org...
> Thanks for the formulas and explanations, but I am not sure how to
implement
> them.. I like math too (more than I did in school!) but I'm not educated
> enough to understand what ABX wrote.. I'd very much like to have the best
> smoothing algoritm in my program..
You do. For heightfields, the method I used is as effecient as any. Nothing
can simplify (Base*Height)/2. Writing the formula as a function MIGHT speed
it up, but with only 2 operations per calculations I'm not sure.
The method described by ABX is necessary only for non-square meshes.
-Shay
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |