estimating an area

Blitz3D Forums/Blitz3D Programming/estimating an area

Andy(Posted 2007) [#1]
I need to estimate the area of an object facing the camera.

This is what I've come up with so far.

frontarea#=50.0
Toparea#=50.0
sidearea#=50.0
totalarea#=0.0

yaw#=45.0
pitch#=0.0
roll#=0.0

totalarea#=Abs(Sin(yaw#)*sidearea#)+Abs(Cos(yaw#)*(Abs(Sin(pitch#)*toparea#)+Abs(Cos(pitch#)*frontarea#)))

Print "Total: "+totalarea#

WaitKey()


It seems to work(although I haven't done much testing), but is there an easier or faster way of doing it?

Any input would be very welcome!

Andy


puki(Posted 2007) [#2]
Out of habit I break calculations into smaller pup-sized chunks. I wouldn't shunt that little maggot into one super-calc.

Not sure if it is quicker - however, I have convinced myself that my way is better and more efficient - frankly more dominant.


Andy(Posted 2007) [#3]
>Out of habit I break calculations into smaller pup-sized
>chunks. I wouldn't shunt that little maggot into one super-
>calc.

That's what I usually do, but I didn't want to bore people with 5 more lines of code.

Does anyone know of a better or more accurate way to do it?


Andy