topical media & game development

talk show tell print

lib-flex-book-com-rubenswieringa-geom-SuperPoint.ax

lib-flex-book-com-rubenswieringa-geom-SuperPoint.ax (swf ) [ flash ] flex


  package com.rubenswieringa.geom {
          
          
          import flash.geom.Point;        
          
          
          
Provides additional functionality for working with Points. @author Ruben Swieringa ruben.swieringa@gmail.com www.rubenswieringa.com www.rubenswieringa.com/blog @version 1.0.0 edit 2 Before modifying and/or redistributing this class, please contact Ruben Swieringa (ruben.swieringa@gmail.com). View code documentation at: http://www.rubenswieringa.com/code/as3/flex/Geom/docs/ *

  
          public class @ax-lib-flex-book-com-rubenswieringa-geom-SuperPoint {
                  
                  
                  
Rounds the x and y values of a Point instance. @point A Point instance. @factor Indicates how much to round the coordinates stored in point. For example, with a factor of 100, an x-value of 12.345678 will become 12.34. With a factor of 1000 it would become 12.345, and so forth. @return A new Point instance storing the round coordinate.

  
                  public static function round (point:Point, factor:uint=1):Point {
                          var newPoint:Point = new Point();
                          newPoint.x = Math.round(point.x*factor)/factor;
                          newPoint.y = Math.round(point.y*factor)/factor;
                          return newPoint;
                  }
                  
                  
          }
          
          
  }


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.