### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Messages - Alexei_B

Pages: 
1
##### Support / Re: How to calculate area?
« on: December 14, 2007, 04:04:30 pm »
Hi raft,

You are absolutely right.  I've changed the way the area is calculated, and now use a vector cross product, i.e

area = | a x b |  / 2

which gives consistent results despite orientation of the cube.

Thanks for your help raft, and sorry for troubling the forum about what is my mistake.

2
##### Support / Re: How to calculate area?
« on: December 14, 2007, 11:03:26 am »
I can see why you ask that question.

For some reason, as I rotate my simple cube, the area calculation changes for a given triangle on the face of the cube.  This seems to be because of the rotation - the visible area decreases as the selected triangle turns away from the view point.

It is because of this that I was concerned about the getTransformedVertex call, and was seeking to "untransform" it.

Perhaps I should be trying to calculate area on the underlying mesh?

3
##### Support / How to calculate area?
« on: December 13, 2007, 05:14:40 pm »
I've parked my attempt to calculate volume for now, and I'm concentrating on simple areas of polygons instead.

My method is to call (pseudo code)

polyManager.getTransformedVertex(polygon,vertex1)
polyManager.getTransformedVertex(polygon,vertex2)
polyManager.getTransformedVertex(polygon,vertex3)

on a polygon. This gives me three vertices which I can then put into a general formula for triangle areas.

However, because these are Transformed verices, i.e. in World Space, the calculated area changes as a object is rotated. I need the absolute vertices of the underlying mesh, so I thought to apply

Matrix mtTransform =obj.getWorldTransformation().invert();

to "untransform" from World to Object vertices.

Does this rather clumsy method sound appropriate?  Any comments welcome.

4
##### Support / Calculate Volume?
« on: December 12, 2007, 03:08:57 pm »
I suspect this simple question may be difficult to answer, but how do I calculate the volume of a closed 3-d shape?   Obviously simple geometric primitives like cubes, rectangles, spheres, cones etc. all have known formulae.

Even shapes bounded by known equations describing planes can have volumes found via 3d integration methods.

But what if I need the volume of a more complex mesh/object representing a simple house for example?

My only thought is that 2d areas can be calculated by iterative methods - literally filling a space with tiny units and counting them - something like how the fill or paint bucket tools work in drawing programmes.  Perhaps this could be extended to a 3d solution?