From: Bruce S. <Bru...@nc...> - 2009-08-13 02:14:19
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> This looks like a candidate for inclusion in Visual. Thanks.<br> <br> Bruce Sherwood<br> <br> Robert Xiao wrote: <blockquote cite="mid:ef6...@ma..." type="cite">I wrote a small frame wrapper class to add these sorts of transformations in a program I developed:<br> <br> class Frame(frame):<br> def world_axes(self):<br> x_axis = norm(self.axis)<br> z_axis = norm(self.axis.cross(self.up))<br> y_axis = norm(z_axis.cross(x_axis))<br> return (x_axis, y_axis, z_axis)<br> <br> def world_offset(self, pos):<br> x,y,z = self.world_axes()<br> return pos.x*x + pos.y*y + pos.z*z<br> <br> def world_pos(self, pos):<br> return self.pos + self.world_offset(pos)<br> <br> def frame_offset(self, pos):<br> x,y,z = self.world_axes()<br> return vector(pos.dot(x), pos.dot(y), pos.dot(z))<br> <br> def frame_pos(self, pos):<br> return self.frame_offset(pos - self.pos)<br> <br> world_pos is the frame->world transformation; frame_pos is the world->frame transformation.<br> <br> Robert<br> <pre wrap=""> <hr size="4" width="90%"> ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/bobj-july">http://p.sf.net/sfu/bobj-july</a></pre> <pre wrap=""> <hr size="4" width="90%"> _______________________________________________ Visualpython-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Vis...@li...">Vis...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/visualpython-users">https://lists.sourceforge.net/lists/listinfo/visualpython-users</a> </pre> </blockquote> </body> </html> |