  | | | reorient center to best fit of BBOX? | reorient center to best fit of BBOX? 2004-05-07 - By Graham D Clark
Back Cheers Raffaele, I have one of those game math books,not sure if its the same one, will look this weekend to see if its in there. The matrix math required looked a bit intimidating last time I checked :/ , and will check the game coding sites now. -- ---- ---- ---- ---- ---- -- http://www.grahamdclark.com <http://www.grahamdclark.com/> 2nd hand TD
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Raffaele "ThE_JacO" Fragapane Sent: May 7, 2004 2:32 PM To: XSI@(protected) Subject: RE: [Script]reorient center to best fit of BBOX?
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 -- ---- ---- ---- ---- ---- -- 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)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:office:word"><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"> <TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR><!--[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]--> <STYLE>@(protected) { font-family: Tahoma; } @(protected) Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; } P.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman" } LI.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman" } DIV.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman" } A:link { COLOR: blue; TEXT-DECORATION: underline } SPAN.MsoHyperlink { COLOR: blue; TEXT-DECORATION: underline } A:visited { COLOR: blue; TEXT-DECORATION: underline } SPAN.MsoHyperlinkFollowed { COLOR: blue; TEXT-DECORATION: underline } P { FONT-SIZE: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: "Times New Roman"; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto } SPAN.EmailStyle18 { COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply } DIV.Section1 { page: Section1 } </STYLE> </HEAD> <BODY lang=EN-US vLink=blue link=blue> <DIV><SPAN class=042191018-07052004><FONT face=Arial color=#0000ff size=2 >Cheers Raffaele,</FONT></SPAN></DIV> <DIV><SPAN class=042191018-07052004><FONT face=Arial color=#0000ff size=2>I have one of those game math books,not sure if its the same one, will look this weekend to see if its in there. The matrix math required looked a bit intimidating last time I checked :/ , <SPAN class=042191018-07052004><FONT face=Arial color=#0000ff size=2>and will check the game coding sites now.</FONT></SPAN></FONT></SPAN></DIV> <DIV><FONT face="Times New Roman">-- ---- ---- ---- ---- ---- --</FONT> <BR><FONT face="Times New Roman"><A href="http://www.grahamdclark.com/">http://www.grahamdclark.com</A></FONT> <BR><FONT face="Times New Roman">2nd hand TD</FONT> </DIV> <BLOCKQUOTE dir=ltr style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px"> <DIV></DIV> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> owner-xsi@(protected) [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>Raffaele "ThE_JacO" Fragapane<BR><B>Sent:</B> May 7, 2004 2:32 PM<BR><B>To:</B> XSI@(protected)<BR><B>Subject:</B> RE: [Script]reorient center to best fit of BBOX?<BR><BR></FONT></DIV> <DIV class=Section1> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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 face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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 face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p>< /SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Also a look around on game coding sites should return enough solution.<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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 face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p>< /SPAN></FONT></P> <DIV> <P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> -~== Raffaele Fragapane ==~-</SPAN></FONT><FONT color=navy><SPAN style="COLOR: navy"> <BR></SPAN></FONT><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> -~== Freelance Technical Animator & TD ==~-</SPAN></FONT><FONT color=navy><SPAN style="COLOR: navy"> <BR></SPAN></FONT><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">-~== Senior Technical Animator @ Peerless Camera ==~-</SPAN></FONT><FONT color=navy><SPAN style="COLOR: navy"> <o:p></o:p></SPAN></FONT></P> <P><FONT face=Arial color=navy size=2><SPAN lang=IT style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">- Currently London Based</SPAN></FONT><FONT color=navy><SPAN style="COLOR: navy"> <BR></SPAN></FONT><FONT face=Arial color=navy size=2><SPAN lang=IT style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">- +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 style="MARGIN-LEFT: 36pt; TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <HR tabIndex=-1 align=center width="100%" SIZE=2> </SPAN></FONT></DIV> <P class=MsoNormal style="MARGIN-LEFT: 36pt"><B><FONT face=Tahoma size=2> <SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN>< /FONT></B><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P style="MARGIN-LEFT: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Any suggestion for how to reorient center of object to best BBOX fit?</SPAN></FONT> <BR><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">To see my issue quickly:</SPAN></FONT> <BR><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">-get cube,</SPAN></FONT> <BR> <FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">-put display in BBOX</SPAN></FONT> <BR><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">-Rotate it</SPAN></FONT> <BR> <FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">-freeze it</SPAN></FONT> <BR><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Now try to get the center orientation back via script.</SPAN></FONT> <o:p></o:p></P> <P style="MARGIN-LEFT: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; 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: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P></DIV><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></BLOCKQUOTE></BODY></HTML>
|
|
 |