tsx programming: geometry question 2004-04-11 - By Richard R. "Remnar"
Back Hi, sorry if this is the wrong place to ask. I have been busy for days adding a new feature into Scatter that will encapsulate a particle onto a face of another polyhedron. What I need help with is analysis on data that I extracted using a test program I wrote. I have tried and tried and tried to use a bounding box to get all my info, but because of point-face orientation, the bounding box never gave me the right results unless I figure out how to create a rotation matrix from the 4 points and the face normal and then invert it then transform the bbox so it is normalized along the x-y plane. Since I really dont know how to do that yet, I sought out another possible way and that is by calculating apothems (is that the right word?) on triangles and Ngons. An apothem is a line from a vertex to the mid point of the oposite site. Calculating this was easy, even for a N gon. Now I got the data, of the size of the face, including the apothems, mid point and length point and line lengths. however it came with 2 or more sets of data that I do not know how to filter out and I have ruled out every possible way I know. I am using a sphere to get this data because it has several axii to test with (actually i should have used a torus to test with). I have determined what the sizes i needed are by use of a point edit selection on each face and finding out what section and face index each one belongs to.
Sphere Face Index = 0 section 1 Location: 0.2454, 0.0488, 0.9493 points[0]: 0.0000, 0.0000, 1.0000 points[1]: 0.3536, 0.1464, 0.9239 points[2]: 0.3827, 0.0000, 0.9239 aperatures[0]: 0.2218 lengths[0]: 0.3902 aperatures[1]: 0.3830 lengths[1]: 0.1493 * aperatures[2]: 0.2218 lengths[2]: 0.3902
target size section 1, 8 = 0.149, 0.383, 0 target size section 2, 7 = 0.276, 0.385, 0 target size section 3, 6 = 0.360, 0.388, 0 target size section 4, 5 = 0.390, 0.390, 0
A sphere has 8 sections top to bottom with faces of certain sizes. Each section has faces = how many latitudes of the sphere.
What I want to find out is why out of the 3 aperature(maybe i got this word wrong, it means apothem length) and length is the 2nd one the correct one? I know its the correct one cuz i selected that face to find out the targe size of the face and section. But the program doesnt know if it is or not.
Now here is 2 more data examples for a 4 sided ngon face on 2 different sections but along the same longitude.
Sphere Face Index = 16 section 2 Location: 0.5242, 0.1043, 0.8155 points[0]: 0.3827, 0.0000, 0.9239 points[1]: 0.3536, 0.1464, 0.9239 points[2]: 0.6533, 0.2706, 0.7071 points[3]: 0.7071, 0.0000, 0.7071 congruant aperature sums[0]: 0.3850, Lengths 0.1493 congruant aperature sums[1]: 0.2126, Lengths 0.3902 congruant aperature sums[2]: 0.3850, Lengths 0.2759 * congruant aperature sums[3]: 0.2126, Lengths 0.3902
Sphere Face Index = 64 Section 5 Location: 0.9253, 0.1841, -0.1913 points[0]: 1.0000, 0.0000, 0.0000 points[1]: 0.9239, 0.3827, 0.0000 points[2]: 0.8536, 0.3536, -0.3827 points[3]: 0.9239, 0.0000, -0.3827 congruant aperature sums[0]: 0.3899, Lengths 0.3902 * congruant aperature sums[1]: 0.3753, Lengths 0.3902 congruant aperature sums[2]: 0.3899, Lengths 0.3605 congruant aperature sums[3]: 0.3753, Lengths 0.3902
You see how the first set there (asterisk) is the 3rd element that holds the correct data, but now we have the last one here that is the first element. I need help determining how to filter out the rest of the elements so I only end up with the correct one. I have tried using the location to determine what coordinate area the face is in. However, i dont think that will work in all cases.
If you need the test code, well its all in Delphi 6 Enterprise.about 81 lines worth. I have built an alternative to all this math stuff and that is to build a face with the vertex data and extract what i need from it. However I prefer not to do this because it would be much slower than the math version. If there is another plugin forum/mailing list I can onto about tsx development, please let me know.
Thanks,
Richard R.
|
|