  | | | reorient center to best fit of BBOX? | reorient center to best fit of BBOX? 2004-05-07 - By Raffaele "ThE_JacO" Fragapane
Back If you have (or feel like buying it) mathematics for 3D games programming and computer graphics there’s a good half a chapter about bounding volumes, also in there you can find a really good explanation of the “best fitting bounding box” maths.
It shouldn’t be too hard to implement, but I don’t have the book here, will have a look into it tonight or tomorrow night if you want.
Also a look around on game coding sites should return enough solution.
Figuring out ideal bounding boxes in the least expensive possible way is something fairly common in the 3Dgames maths scenario.
-~== Raffaele Fragapane ==~- -~== Freelance Technical Animator & TD ==~- -~== Senior Technical Animator @ Peerless Camera ==~-
- Currently London Based - +44 798 4955734
__ __
From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Graham D Clark Sent: Friday, May 07, 2004 6:42 PM To: xsi@(protected) Subject: [Script]reorient center to best fit of BBOX?
Any suggestion for how to reorient center of object to best BBOX fit? Ie if an elongated cubes points are rotated, center remains, then its frozen, getting the center orientation back so that the BBOX would be the same as the elongated cubes? (preferabley with y pointing in longest direction of mesh)
Ie2 if a cylinders center is moved away and reorinted, and frozen, a way to return the center as close as possible to the orginal orientation?
To see my issue quickly: -get cube, -put display in BBOX -Rotate it -freeze it Now try to get the center orientation back via script.
I can do it manually with ref edges but I have many many objects with centers way off and edgeloops commands are not yet exposed in any version of XSI.
Perhaps first I need to move center to average vertices, and perhaps use edge looping no corners, get top 20 % longest continuos edge loops, collecting the end points and using the average vector as y orientation, or perhaps reorienting a BBOX scaling in to mesh surface by checking for points outside the BBOX, and reorinting until best fit...
Anyways these ideas seem kind of lame. Anyone have a suggestion? Is there an easier way using basic XSI commands?
Thank you, Graham -- ---- ---- ---- ---- ---- -- HYPERLINK "http://www.grahamdclark.com"http://www.grahamdclark.com 2nd hand TD
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.638 / Virus Database: 409 - Release Date: 21-Mar-04 (See http://Mar-04.ora-code.com)
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.638 / Virus Database: 409 - Release Date: 21-Mar-04 (See http://Mar-04.ora-code.com)
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft -com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http: //www.w3.org/TR/REC-html40">
<head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252 (See http://ows-1252.ora-code.com)">
<meta name=Generator content="Microsoft Word 11 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title>[Script]reorient center to best fit of BBOX?</title> <style> <!-- /* Font Definitions */ @(protected) {font-family:Tahoma; panose-1 (See http://ose-1.ora-code.com):2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:blue; text-decoration:underline;} p {mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; font-size:12.0pt; font-family:"Times New Roman";} span.EmailStyle18 {mso-style-type:personal-reply; font-family:Arial; color:navy;} @(protected) Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>If you have (or feel like buying it) mathematics for 3D games programming and computer graphics there’s a good half a chapter about bounding volumes, also in there you can find a really good explanation of the “best fitting bounding box” maths.<o:p></o:p>< /span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>It shouldn’t be too hard to implement, but I don’t have the book here, will have a look into it tonight or tomorrow night if you want.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>Also a look around on game coding sites should return enough solution.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>Figuring out ideal bounding boxes in the least expensive possible way is something fairly common in the 3Dgames maths scenario.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family: Arial;color:navy'> -~== Raffaele Fragapane ==~-</span></font><font color=navy><span style='color:navy'> <br> </span></font><font size=2 color=navy face=Arial><span style='font-size:10.0pt; font-family:Arial;color:navy'> -~== Freelance Technical Animator & TD ==~-</span></font><font color=navy><span style='color:navy'> <br> </span></font><font size=2 color=navy face=Arial><span style='font-size:10.0pt; font-family:Arial;color:navy'>-~== Senior Technical Animator @ Peerless Camera ==~-</span></font><font color=navy><span style='color:navy'> <o:p></o:p></span> </font></p>
<p><font size=2 color=navy face=Arial><span lang=IT style='font-size:10.0pt; font-family:Arial;color:navy'>- Currently London Based</span></font><font color=navy><span style='color:navy'> <br> </span></font><font size=2 color=navy face=Arial><span lang=IT style='font-size:10.0pt;font-family:Arial;color:navy'>- +44 798 4955734</span>< /font><font color=navy><span lang=IT style='color:navy'> </span></font><o:p></o:p></p>
</div>
<div>
<div class=MsoNormal align=center style='margin-left:36.0pt;text-align:center'> <font size=3 face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal style='margin-left:36.0pt'><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font ></b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> owner-xsi@(protected) [mailto:owner-xsi@(protected)] <b><span style='font-weight:bold'>On Behalf Of </span></b>Graham D Clark<br> <b><span style='font-weight:bold'>Sent:</span></b> Friday, May 07, 2004 6:42 PM <br> <b><span style='font-weight:bold'>To:</span></b> xsi@(protected)<br> <b><span style='font-weight:bold'>Subject:</span></b> [Script]reorient center to best fit of BBOX?</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span>< /font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span>< /font></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>Any suggestion for how to reorient center of object to best BBOX fit?</span></font> <br> <font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Ie if an elongated cubes points are rotated, center remains, then its frozen, getting the center orientation back so that the BBOX would be the same as the elongated cubes? (preferabley with y pointing in longest direction of mesh)</span></font> <o:p></o:p></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>Ie2 if a cylinders center is moved away and reorinted, and frozen, a way to return the center as close as possible to the orginal orientation?</span></font><o:p></o:p></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>To see my issue quickly:</span></font> <br> <font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>-get cube,</span></font> <br> <font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>-put display in BBOX</span></font> <br> <font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>-Rotate it</span></font> <br> <font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>-freeze it</span></font> <br> <font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Now try to get the center orientation back via script.</span></font> <o:p></o:p></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>I can do it manually with ref edges but I have many many objects with centers way off and edgeloops commands are not yet exposed in any version of XSI.</span></font><o:p></o:p></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>Perhaps first I need to move center to average vertices, and perhaps use edge looping no corners, get top 20 % longest continuos edge loops, collecting the end points and using the average vector as y orientation, or perhaps reorienting a BBOX scaling in to mesh surface by checking for points outside the BBOX, and reorinting until best fit... </span>< /font><o:p></o:p></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>Anyways these ideas seem kind of lame. Anyone have a suggestion? Is there an easier way using basic XSI commands?</span></font> <o:p ></o:p></p>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size: 10.0pt;font-family:Arial'>Thank you, Graham</span></font> <br> -- ---- ---- ---- ---- ---- -- <br> <a href="http://www.grahamdclark.com">http://www.grahamdclark.com</a> <br> 2nd hand TD <o:p></o:p></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span>< /font></p>
</div>
</body>
</html> <BR>
<P><FONT SIZE=2>---<BR> Incoming mail is certified Virus Free.<BR> Checked by AVG anti-virus system (http://www.grisoft.com).<BR> Version: 6.0.638 / Virus Database: 409 - Release Date: 21-Mar-04 (See http://Mar-04.ora-code.com)<BR> </FONT> </P><BR>
<P><FONT SIZE=2>---<BR> Outgoing mail is certified Virus Free.<BR> Checked by AVG anti-virus system (http://www.grisoft.com).<BR> Version: 6.0.638 / Virus Database: 409 - Release Date: 21-Mar-04 (See http://Mar-04.ora-code.com)<BR> </FONT> </P>
|
|
 |