20 12 2011 Red: points projected to Y = 0
Black: min,max X of min,max Z
Green: max X
Blue: min X

The source code won’t be uploaded until optimized

So, It works like this:
1. Get all the vertices (position) [Indices of polygons don’t matter]
The prm loading’s source can be found in Tools -> nVolt
[projecting to Y = 0]
2. Sorting algorithm (I used Bubble sorting) [by Z]
3. get the min and the max [by Z], then min, max [by X]
we now get 4 points: that’s the rectangle (I used distance between .Z -> .Z)
4. Now We’re going to split virtually the points (into cubes-alike) [see Math explication for this]
5. Finally, We link all of them

pseudo-C

 CODE vertex[] v = getVertices(); vector2D[] point; For (i=0;i { point = Scalar_product(v[i],getVector(1,0,1)); } BubbleSort(point); //sort by bubble BubbleSort(SearchNeighborPoints(point)); //min BubbleSort(SearchNeighborPoints(point)).getLatest(); //max BubbleSort(SearchNeighborPoints(point.getLatest)); BubbleSort(SearchNeighborPoints(point.getLatest)).getLatest();

Pseudo-Math

 QUOTE init <– 0 for i:= 0 to length(points) [or use Repeat..Until ; Do… While]We define |x| = max(-x,x) |point[i].z – point[init].z| < n n = Positif Constant  . We take it by “precision” We shall repeat this until |point[i].z – point[init].z| >= n then, we move to: init <– i+ 1 and until (i > length(points) – 1) Now, after getting the wanted, We bubble Sort the points then We checked if the min is on the left and the max is on the right We calculate the boundingbox then for that : for X, Y then Z each separately (XYZ) we’ve got: MAX <– max(MAX,point[i].XYZ) MIN <– min (MIN, point[i].XYZ) The center shall be:Center <– MAX/2 + MIN/2 if (MAX – Center).z >0 then everything is alright (same with (MIN-Center).z ) otherwise drop, not to include

Finally, we link the max_points (0->length(max)) then min_points (length(min) -> 0) or the opposite (0->length(min) then length(max)->0)

21 12 2011