Author Topic: Moving, Scaling, and Rotating Points  (Read 10312 times)

0 Members and 1 Guest are viewing this topic.

zoltan

  • Guest
Moving, Scaling, and Rotating Points
« on: March 04, 2006, 04:44:15 PM »
If I have a list of points, what is the fastest way to translate, rotate or scale them?

Jürg Menzi posted a file with matrix functions a while back.  How do I use these funcitions to apply them to a list of points and return a new list of points?

It's got to run fast, too!

LE

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #1 on: March 04, 2006, 05:10:11 PM »
Zoltan;

In my case, I need to know what is the intention of your code, what are you trying to do, do you have some image or graphics that reflect the end result?... etc....

From there, I might be able to help...

I see you are asking for speed [fast].... why you want to use lisp ?

Have fun
« Last Edit: March 04, 2006, 06:01:46 PM by LE »

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #2 on: March 04, 2006, 06:26:33 PM »
Sure, let me clearify.

I want to draw text to an image tile in a dialog box using the Vector_Image command .  I have lists of points that I have extracted from exploded text which are all of the ASCII characters 1 unit tall at the origin.  Translating the points to create a list of segments for words is easy, but I want to make it also scale and roate the text.

So. I have a list of 2D points....
((0.032 0.0432)
 (0.432 0.3432)
 (0.432 0.4323)
 ...
)

I need three reosonably fast functions such as this:

(TranslatePoints List BasePoint DestinationPoint)

(RotatePoints List BasePoint Angle)

(ScalePoints List BasePoint ScaleFactor)

They will return a new list int the same form which I will feed to the Vector_Image function.  They should be fast enough to translate a few hundred segments without a noticable pause (not BLAZING fast or anything).

I'm writing a generic function for writing text to an image tile or image button.  I have a "font" file which is a list of points for each character and I will ultimate have a function that will write a line of text to an image at a location, size and rotation, using a given font.

(Text_Image Key Point Angle Height String Font Color)

I figure point transformation is prety basic and someone already has a good, fast function to scale and rotate a list of points better than what I could write.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving, Scaling, and Rotating Points
« Reply #3 on: March 05, 2006, 12:16:08 PM »
To get you started ..

This is the pointList for the vertex's of the attached shape.

 
Code: [Select]
(setq ptList '((0 0)
               (-100.0 -50.0)
               (-100.0 50.0)
               (50.0 50.0)
               (50.0 150.0)
               (250.0 150.0)
               (250.0 0.0)
               (200.0 0.0)
               (200.0 -50.0)
               (-100.0 -50.0)
              )
)

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving, Scaling, and Rotating Points
« Reply #4 on: March 05, 2006, 12:19:18 PM »
Code: [Select]
(defun MovePoints (PointList MoveBasePoint MoveVector /)
  (mapcar
    '(lambda (pt) (mapcar '+ MoveVector (mapcar '- pt MoveBasePoint)))
    (if (atom (car PointList))
      (list PointList)
      PointList
    )
  )
)


(MovePoints (list 1 1 ) (list 0 0 ) (list 100 -100))
Code: [Select]
((101 -99))

(MovePoints ptList (list 0 0) (list 0 250))
Code: [Select]
((0 250) (-100.0 200.0)
         (-100.0 300.0)
         (50.0 300.0)
         (50.0 400.0)
         (250.0 400.0)
         (250.0 250.0)
         (200.0 250.0)
         (200.0 200.0)
         (-100.0 200.0)
)


(MovePoints ptList (list 0 0) (list 1000 -1000))
Code: [Select]
((1000 -1000) (900.0 -1050.0)
              (900.0 -950.0)
              (1050.0 -950.0)
              (1050.0 -850.0)
              (1250.0 -850.0)
              (1250.0 -1000.0)
              (1200.0 -1000.0)
              (1200.0 -1050.0)
              (900.0 -1050.0)
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving, Scaling, and Rotating Points
« Reply #5 on: March 05, 2006, 12:27:44 PM »
Code: [Select]
(defun scalePoints (PointList ScaleBasePoint ScaleFactor / ScaleList)
  (setq ScaleList (list ScaleFactor ScaleFactor ScaleFactor))
  (mapcar '(lambda (pt)
             (mapcar '+
                     ScaleBasePoint
                     (mapcar '* ScaleList (mapcar '- pt ScaleBasePoint))
             )
           )
          (if (atom (car PointList))
            (list PointList)
            PointList
          )
  )
)

( scalePoints (list 10 20) (list 0 0) 3.52)
Code: [Select]
((35.2 70.4))
( scalePoints ptList (list 0 0) 0.5)
Code: [Select]
((0.0 0.0) (-50.0 -25.0)
           (-50.0 25.0)
           (25.0 25.0)
           (25.0 75.0)
           (125.0 75.0)
           (125.0 0.0)
           (100.0 0.0)
           (100.0 -25.0)
           (-50.0 -25.0)
)

( scalePoints ptList (list -100 -50 ) 2.0)
Code: [Select]
((100.0 50.0) (-100.0 -50.0)
              (-100.0 150.0)
              (200.0 150.0)
              (200.0 350.0)
              (600.0 350.0)
              (600.0 50.0)
              (500.0 50.0)
              (500.0 -50.0)
              (-100.0 -50.0)
)

I'm going out, so the Rotate will have to wait.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Moving, Scaling, and Rotating Points
« Reply #6 on: March 05, 2006, 01:01:34 PM »
Good stuff Kerry.
TheSwamp.org  (serving the CAD community since 2003)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving, Scaling, and Rotating Points
« Reply #7 on: March 05, 2006, 01:16:46 PM »
Thanks Mark, but I stand on the shoulders of Giants. :-)

BTW , those should work for 3D points as well ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving, Scaling, and Rotating Points
« Reply #8 on: March 05, 2006, 01:53:40 PM »
Zoltan,

As you have Jürg's Matrix Library [ I can't get it till the Lilly_Pond plumbing is fixed ] ,

Have a look at this for the Rotation ..
http://www.theswamp.org/index.php?topic=8251.msg105994#msg105994
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Moving, Scaling, and Rotating Points
« Reply #9 on: March 05, 2006, 02:37:43 PM »
That would be sweet indeed...

Quote
...
I want to draw text to an image tile in a dialog box using the Vector_Image command .  I have lists of points that I have extracted from exploded text which are all of the ASCII characters 1 unit tall at the origin.  Translating the points to create a list of segments for words is easy, but I want to make it also scale and roate the text.
...
I'm writing a generic function for writing text to an image tile or image button.  I have a "font" file which is a list of points for each character and I will ultimate have a function that will write a line of text to an image at a location, size and rotation, using a given font.
...

Have you checked out Terry Miller's vector_line creation function?

Code: [Select]
From Terry's routine:
;-------------------------------------------------------------------------------
; Program Name: GetVectors.lsp [GetVectors R3]
; Created By:   Terry Miller (Email: terrycadd@yahoo.com)
;               (URL: http://web2.airmail.net/terrycad)
; Date Created: 12-7-01
; Function:     c:GetVectors explodes selected entities into lines segments and
;               writes vector points to C:\Temp\Vectors.lsp which may be viewed
;               by c:ViewVectors.
; Note: There are a few informative notes at the end of this file.
;-------------------------------------------------------------------------------
; Revision History
; Rev  By     Date    Description
;-------------------------------------------------------------------------------
; 1    TM   12-7-01   Initial version
; 2    TM   5-20-04   Added dialogs to assist in creating dialog images.
; 3    TM   3-20-05   Added c:Palet function to view AutoCAD's 255 colors.
;-------------------------------------------------------------------------------
; GetVectors is a programming tool for creating dialog images from AutoCAD
; entities. The entities selected will be exploded into line segments to create
; the image and dialog files C:\Temp\Vectors.lsp and C:\Temp\Vectors.dcl.
; Use the function ViewVectors to view the images created by GetVectors. The
; image and dialog files created by GetVectors may be pasted into your own
; programs and modified as needed.
;-------------------------------------------------------------------------------
; Instructions: Draw a rectangle in units corresponding to the pixel units of
; the image you want to create. For example to create a 50 x 50 pixel image,
; draw a rectangle from 0,0 to 49,-49. Copy and scale the entities you want to
; include in your image into the limits of the outlined rectangle. GetVectors
; creates the blocks GetVectors and DupVectors for reference. Move the blocks
; or the entities off to the side and make modifications as needed.
;-------------------------------------------------------------------------------
; Overview of Main Functions
;-------------------------------------------------------------------------------
; c:GetVectors - Creates an image and dialog file of entities selected.
; c:GV - Shortcut for c:GetVectors
; GetVectors - Function called by c:GetVectors that explodes selected entities
;    into lines segments and writes vector points to C:\Temp\Vectors.lsp.
; WmfExplode - Function called by GetVectors that creates a WMF file of the
;    selection and then explodes the WMF entities into lines.
; c:ViewVectors - View vectors created by c:GetVectors in C:\Temp\Vectors.lsp.
; c:VV - Shortcut for c:ViewVectors
; c:ImageAtts - Image Attributes dialog used to calculate the height and width
;    of dialog images.
; c:IA - Shortcut for c:ImageAtts
; c:Palet - Displays a Palet Image to view AutoCAD's 256 colors.
; c:PI - Shortcut for c:Palet
;-------------------------------------------------------------------------------
; c:GetVectors - Creates an image and dialog file of entities selected.
;-------------------------------------------------------------------------------


Gary


Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #10 on: March 05, 2006, 11:02:55 PM »
Kerry, Thanks alot for saving me lots of work.  That function by Jurg was exactly what I was looking for.  Thanks! I knew I had seen it somewhere.

Gary, That is the function which gave me the idea.  I made a loop that put each of the 255 ASCII characters to the origin one at a time using the current shx font and I a method similar to Terry's routine to explode the text to lines.  Then I collected the end points to create the "font" file which I will now scale and rotate with a little help from Kerry and Jurg.

I will post it up here Tomorrow or the next day.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving, Scaling, and Rotating Points
« Reply #11 on: March 06, 2006, 12:20:50 AM »
My pleasure.

I know you'll reciprocate :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Moving, Scaling, and Rotating Points
« Reply #12 on: March 06, 2006, 11:54:57 AM »
Quote
I will post it up here Tomorrow or the next day.

Can't wait to see it...

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #13 on: March 08, 2006, 08:46:53 AM »
Ok..Between doing what I'm supposed to be doing and sleeping I got this somewhat together.  It still needs work, though.

The insertion point and rotation are completely out to lunch! I have not had the time to look into it.
Also, I can't get it to draw vectors before or after the text.  They just don't show up!!  I had originally intended to do it like this:
(Start_Image ... )
(Fill_Image ... )
(Text_Image ... )
(End_Image )

This did not work.  It would not draw any vectors.  So I had to put Start_Image and End_Image in the loop and start and end the image for every vector.  Now I can't add more vector before of after the Text_Image function.
This is not good.  In application, it will have to work with other vector_Image calls and multiple calls to Text_Image.
So I'm stumped on this one.

The Progy to make the fonts Text2Vec is a little funny.  I originally did the lazy thing and turned the Express Tools command Explode Text into a function that I gave a selection set to.  It was slow, but it worked.  Later I refined it by taking code from Terry Miller's GetVectors.lsp to make it faster, but it might be a little flacky based on looking at the commands calls fly by.  You can comment out my txtexp function and uncomment the whole express one and see the difference.

You can use the TestVecs progy to test the font.

*****CHANGE THE PATH IN THE C:TESTTEXT OR IT WON'T WORK!!!!!!!!!
(SetQ sPath "E:\\Programming\\Lisp\\Text2Vec\\" )

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #14 on: March 08, 2006, 11:18:07 PM »
OK,  A couple of revisions since this morning.  I found out that calling Get_Tile or Set_Tile in between the Start_Image and End_Image calls really messes things up. so I revised the Draw_Text function to look like this:
Code: [Select]
(Defun Draw_Text ( / xmax ymax posx posy rot height text space vecs)
 (SetQ xmax   (DimX_Tile "textimage")
       ymax   (DimY_Tile "textimage")
       posx   (DistoF (Get_Tile "posx"))
       posy   (DistoF (Get_Tile "posy"))
       rot    (AngtoF (Get_Tile "rot"))
       height (DistoF (Get_Tile "height"))
       text   (Get_Tile "text")
       space  (DistoF (Get_Tile "space"))
 )
 
 (Start_Image "textimage" )
 (Fill_Image
  0
  0
  xmax
  ymax
  -2
 )
 
 (Vector_Image
  0
  (Fix posy )
  xmax
  (Fix posy )
  1
 )

 (Vector_Image
  (Fix posx )
  0
  (Fix posx )
  ymax
  1
 )

 (SetQ vecs
           (ItoA
            (Text_Image
             posx
             posy
             rot
             height
             text
             lstCurrentFont
             space
             2
            )
           )
 )

 (End_Image )
 (Set_Tile "vectors" vecs )
)
now that works... so also take out the Start_Image and End_Image calls in the Text_Image loop.

I determined that the messed up text insertion point and rotation base point was caused by the MeRotatePointList function.  Unless Jürg gives me some insite about how I'm using his function wrong, I will have to dig through it and try to understand it, or re-write it entirelly.  (let's hope Jürg jumps into this thread soon!).

  Other than that everything is groovy.  The Text2Vec program seems to work, it just does not give any visual indication that it's doing anything.  That's always fun!

GDF

  • Water Moccasin
  • Posts: 2081
Re: Moving, Scaling, and Rotating Points
« Reply #15 on: March 09, 2006, 10:19:30 AM »
zoltan

Don't forget to clear your vector line image....so that when you select another font within your dialog box you don't get images on top of one another.


Gary
« Last Edit: March 10, 2006, 10:54:56 AM by Gary Fowler »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Moving, Scaling, and Rotating Points
« Reply #16 on: March 10, 2006, 10:53:45 AM »
zoltan

Quote
Don't forget to clear your vector line image....so that when you select another font within your dialog box you don't get images on top of one another.

This is a quick update to your routine, so that it will reset the dialog box image.

Code: [Select]
(defun ResetTextImage  ()
  (SetQ xmax   (DimX_Tile "textimage")
        ymax   (DimY_Tile "textimage")
        posx   (DistoF (Get_Tile "posx"))
        posy   (DistoF (Get_Tile "posy"))
        rot    (AngtoF (Get_Tile "rot"))
        height (DistoF (Get_Tile "height"))
        text   (Get_Tile "text")
        space  (DistoF (Get_Tile "space")))
  (Start_Image "textimage")
  (Vector_Image 0 (Fix posy) xmax (Fix posy) 1)
  (Vector_Image (Fix posx) 0 (Fix posx) ymax 1)
  (fill_image 0 0 xmax ymax -2)
  (End_Image))

(Defun Draw_Text  (/ xmax ymax posx posy rot height text space vecs)
  (ResetTextImage)
  (SetQ xmax   (DimX_Tile "textimage")
        ymax   (DimY_Tile "textimage")
        posx   (DistoF (Get_Tile "posx"))
        posy   (DistoF (Get_Tile "posy"))
        rot    (AngtoF (Get_Tile "rot"))
        height (DistoF (Get_Tile "height"))
        text   (Get_Tile "text")
        space  (DistoF (Get_Tile "space")))
  (Start_Image "textimage")
  (fill_image 0 0 xmax ymax -2)
  (Vector_Image 0 (Fix posy) xmax (Fix posy) 1)
  (Vector_Image (Fix posx) 0 (Fix posx) ymax 1)
  (SetQ vecs (ItoA (Text_Image posx posy rot height text lstCurrentFont space 2))) ;set color
  (End_Image)
  (Set_Tile "vectors" vecs))

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #17 on: March 10, 2006, 06:38:26 PM »
I'm confused here, Gary.  You are calling
Code: [Select]
(Vector_Image 0 (Fix posy) xmax (Fix posy) 1)
(Vector_Image (Fix posx) 0 (Fix posx) ymax 1)
(fill_image 0 0 xmax ymax -2)
in the ResetTextImage subroutine to clear the image and draw the crosshairs for the insertion point and then you are calling them again in the DrawText subroutine.  But I would agree with you that clearing the image should be a seperate subroutine that can be called at any time.

Keep in mind that this whole program is just to test the function of the Text_Image function.

By the way, where the heck is Jürg to help me out with his MeRotatePointList function?!?!

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Moving, Scaling, and Rotating Points
« Reply #18 on: March 11, 2006, 05:43:19 AM »
By the way, where the heck is Jürg to help me out with his MeRotatePointList function?!?!
Zoltan, I can't scan all messages during my work time. In this case send me a PM to get my attention... :-)

All right, what's the problem with MeRotatePointList?

Cheers

A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #19 on: March 11, 2006, 08:48:18 AM »
Jürg

Thank you so much for helping me out.

I don't know if I have implemented your function correctly.  If you read through this thread, I have created a function to write text to an image tile in lisp using a "font" which is a list of start point - end point pairs for each ascii character.  The lists are concatenated to form a string of text that is given to a loop which feeds it to a Vector_Image call to draw them to the tile.  All of the characters in the font file are stored at 0,0 with a rotation of 0 and a height of 1.  When the text string is built, the first list of points is moved to the insertion point of the text and the other characters are translated to the right by a distance given by the characters with plus the space between the characters.  This is done with Kerry Brown's MovePoints function.

Then the entire list of points for the text string is scaled about the insertion point to get the desired text height and then rotated around the insertion point by the rotation angle before it is looped to the Vector_Image function.

I has re-attached the zip file with the latest changes.  Load the files and run the C:TestText prog.  The red lines are the insertion point of the text.  When the MeRotatePointList function call to rotate the text is not commented out, the text is translated away from the insertion point.  The rotation angle is correct (albeit backwards since the stupid image tile coordinate system is upside-down!), but the base point is moved.


Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Moving, Scaling, and Rotating Points
« Reply #20 on: March 11, 2006, 09:33:03 AM »
Zoltan

I will check that out... sunday or moday.
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Moving, Scaling, and Rotating Points
« Reply #21 on: March 13, 2006, 12:57:56 PM »
Zoltan

Couldn't check all details, but I've seen that the vector list has an offset to the rotation point,
means there is no point in the list at ~0,0,0...
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #22 on: March 13, 2006, 03:29:16 PM »
Yes, that is exactly what is going on.  Even with the rotation angle set to 0, the vectors are all away from the origin point.  If you comment out the line that processes the rotation, you will see that the text will be on the red cross-hairs that mark the insertion point.

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #23 on: March 13, 2006, 07:17:07 PM »
Ok... I managed to somehow sort out the issue by changing around the logic of the insertion point.

I added a Justification parameter and fixed some isses with empty strings and leading spaces.  Give it a run and see if anything is wrong, particularly the application of the justification. 

Also, if anyone would like to try to come up with ways of making it faster, I would love to hear about it.  In practical application, small text on the image tile looks fine using RomanS or RomanD. They run fast enough and look good at small text height.  It gets a little slow when using TrueType fonts since they produce so many line segments.  I'm sure with a little streamlining, we could make it very practical for writing larg paragraphs of TrueType to the image.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Moving, Scaling, and Rotating Points
« Reply #24 on: March 14, 2006, 03:01:24 AM »
Hi Zoltan

The main reason for slow down your function is the sub 'Text_Image'. Independent of the parameter you're change
in the dialog, the sub executes *all* calculations. You should split the calc's to the necessary behaviour, eg.:
- Change rotation angle -> calculate rotation -> draw vec's
- Change height -> calculate scale -> draw vec's
etc.

Another hint (has no big influence to speed), my matrix functions can be used to scale and move also:
Code: [Select]
;
; == Function MeScalePointList
; Scales a point list referring to the base point by a factor.
; Copyright:
;   ©2001 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
;   Ptl = Point list [LIST]
;   Bpt = Base point [LIST]
;   Scl = Scale factor [REAL]
; Return [Type]:
;   Point list [LIST]
; Notes:
;   - None
;
(defun MeScalePointList (Ptl Bpt Scl / MatOcs)
 (setq MatOcs (MeMatScale Scl Bpt))
 (mapcar '(lambda (l) (MeTrans l MatOcs)) Ptl)
)
;
; == Function MeMovePointList
; Moves a point list referring to the base point by displacement.
; Copyright:
;   ©2001 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
;   Ptl = Point list [LIST]
;   Bpt = Base point [LIST]
;   Dpt = Displacement point [LIST]
; Return [Type]:
;   Point list [LIST]
; Notes:
;   - None
;
(defun MeMovePointList (Ptl Bpt Dpt / MatDsp MatOcs)
 (setq MatOcs (MeMatRotZ (angle Bpt Dpt) '(0.0 0.0 0.0))
       MatDsp (MeTrans (list (distance Bpt Dpt) 0.0 0.0) MatOcs)
 )
 (mapcar '(lambda (l) (MeVecAdd l MatDsp)) Ptl)
)

A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

zoltan

  • Guest
Re: Moving, Scaling, and Rotating Points
« Reply #25 on: March 14, 2006, 07:18:25 AM »
Jürg,

While it is true that the Text_Image function has to create and process a new list of vectors every time, the purpose of this exercise is not the application "Test Test".  The Test Test is just a test function to debug the Text_Image function which is intended to stand alone and be used in any application to write text to any image tile in any dialog box.

To make the performance change you are talking about would require the main application to store the list of vectors along with all of the parameters to determine what changed and then process the same list of vectors.  This would only increase the speed of subsequent changes to the same vector list.  While this is applicable to my test function, in normal application one would typically not write text to a image and than change just the rotation of the same text unless they were trying to create some kind of animated effect.  Normally, the Text_Image function would be called to write a string to an image and then called again to write another string to the same or another image.

One performance increase that I could do is not calculate the rotation if it is set to 0, which will be most cases.

Thank you for your input, Jürg.