Probem with finding out Transformed objects Points.

  • Hi All,
    I have rotated a selected object with NSAffineTransform.Now i need to
    reset my resizig handler locations to the corners of the rotated
    object.which are at the 4 corners of the object.I have implemented the
    rotaion over the Sketch(eg).If anybody knows how to find it  please
    help me to resolve the issue.
    Thanks In Advance.
  • First: You need to understand what you are doing when you transform a coordinate system using NSAffineTransform.  A mailing list is not a good forum for detailed explanation of basic computer graphics principals.  There are lots of good books on the subject including the seminal text book, "Computer Graphics, Principles and Practice" by Foley & Van Dam et. al.

      There are less comprehensive free explanations on the web as well.

      Second: You can use methods like the following:
      - (NSPoint)transformPoint:(NSPoint)aPoint
    - (NSSize)transformSize:(NSSize)aSize
    - (void)invert

      The basic idea is that to transform a point in a rotated/scaled/translated coordinate system into the "base"  coordinated system system, you use -transformPoint:.  In your case, the "base" coordinate system will be the untransformed coordinate system of the view.

      To go the other way and convert a point in base coordinates to a point in the transformed coordinate system, invert the affine transform matrix and use -transformPoint:.  Just be cautious that not all affine transforms have an inverse!
previous month november 2006 next month
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Go to today