How to get the coordinates of "pathPoints" of a textFrameItem?

Hi all

Yes, I know that textFrameItems have pathPoints but...

How can I get the x coordinates of the corners of a textFrameItem of rotation.

I know I can get the angle of rotation of asin (myTextFrameItem.matrix.mValueA) etc.

My guess would be that one should be able to use the mValueTX and mValueTY to help, but these values are very confusing and change dramatically on the application even a small rotation.

If anyone has some preference mathematically based ideas and not API base, please let me know.

It's very late by me now and I think I must be missing what is obvious, I think that such a function must have been made.

Thank you

Trevor

PS Would be also appreciated a solution to the problem even in InDesign

_2015-06-23_02-05-49.png

Hi all

I didn't try the method DOM I knew the mathematical method.

I don't give great results if a shear has been applied, but that doesn't bother me that I do not apply the shears

I received contact details-box-find http://stackoverflow.com/questions/9971230/calculate-rotated-rectangle-size-from-known-bou a useful formula

y = (1 / (Math.cos (a) * Math.cos (a) - Math.sin (a) * Math.sin (a))) * (-w * Math.sin (a) + h * Math.cos (a));

where y is the height of the inner when box no rotation is applied on it and a is the angle of rotation and w is the width.

I had found for me a different formula but got stuck when moving to the rotation out of the 90 degree range, that is to say 1 degree or 91 degrees.

The same problem occurred with this method to fix a fact of what follows.

a RAD = ((360 + degs (a)) 90%);

I did the temporary to degrees conversion as I remember problems with Mod enforcement by a fraction, I think that Ariel was a thread on this in the indesign forum.

Here are the results of the script

// draw a text box and rotate it before running the script
// By Trevor www.creative-scripts.com (sorry still not too much there)
// https://forums.adobe.com/message/7678561#7678561
// With a little bit of help from http://stackoverflow.com/questions/9971230/calculate-rotated-rectangle-size-from-known-bounding-box-coordinates
function main () {

var doc = app.documents.length && app.activeDocument,
    itext = doc && doc.textFrames[0];
if (!itext) {
    alert ("Sorry mate,\nI need a document with a textFrameItem on it or there's not much for me to do");
    return "twit";
}
var gb = itext.geometricBounds,
    imatrix = itext.matrix,
    p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y,
    a, h, w, x, y, hyp, op, adj,
    noColor = new NoColor(),
    rgbColor = new RGBColor(),
    newShape = doc.pathItems.add(),
    rect;
;

// Do the maths

a = Math.atan2 (imatrix.mValueB, imatrix.mValueA); // get the angle of the textFrameItem
a = rads ((360 + degs(a)) % 90); // make sure it's positive otherwise the result will get messed up
w = gb[2] - gb[0]; // Width of outer enclosing box
h = gb[1] - gb[3]; // Height of outer enclosing box
/* x = (1/(Math.cos(a) * Math.cos(a) - Math.sin(a) * Math.sin(a))) * (w * Math.cos(a) - h * Math.sin(a)); // Width of inner enclosed box, this is not needed for this script */
y = (1/(Math.cos(a) * Math.cos(a)- Math.sin(a) * Math.sin(a))) * (- w * Math.sin(a) + h * Math.cos(a)); // Height of inner enclosed box
op = Math.sin(a) * y; // this is the x coordinate offset
adj = Math.cos(a) * y; // this is the y coordinate offset

// calculate the points of the inner enclosed box
p1X = gb[0] + op; // left bottom
p1Y = gb[3];
p2X = gb[0]; // left top
p2Y = gb[3] + adj;
p3X = gb[2] - op; // right top
p3Y = gb[1];
p4X = gb[2]; // right bottom
p4Y = gb[1] - adj;

// Draw outer box
rgbColor.blue = 255;
rect = doc.pathItems.rectangle(gb[1], gb[0], gb[2]-gb[0], Math.abs(gb[3]-gb[1]) );
rect.fillColor = noColor;
rect.strokeColor = rgbColor;

// Draw inner box
newShape.setEntirePath([[p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p1X, p1Y]]);
rgbColor.red = 255;
newShape.strokeColor = rgbColor;
newShape.fillColor = noColor;

// Helper functions
function rads (x) {return x * (Math.PI / 180);}
function degs (x) {return x * (180 / (Math.PI));}

}
main()

Hi Uwe,

It was late, but I don't know how I missed the path object. Age!

A good thing I didn't post on the InDesign forum, at least here, I can wait less snickering for a such silent over look that I went back to the InDesign forum

Either way thanks to you two, best regards,.

Trevor

Tags: Illustrator

Similar Questions

  • How to get the coordinates of a Swipe gesture?

    Hi guys! I build a game similar to Fruit Ninja and recently, I encountered the following problem: How can I access the points of contact of a cause of event drag as you now to tear a piece of fruit, I need to know if you hit points are same as the location of the fruit.

    So, basically, it's something like:

    If {(Swipe.x is fruit.x)

    Destroyfruit();

    }

    So is it possible to understand the coordinates suddenly?

    Thank you

    Gestures have phases. Shot has a begin and end and not raise any events outside of those. You won't be able to get the coordinates to start drag and at the end. Don't use no gestures, use regular events of Touch with stageX and stageY (or localX and localY if limited to a certain area). These events go off quickly and continuously. You can simplify it by listening to just TouchEvent.TOUCH_MOVE because it fires so quickly.

  • How to get the coordinates of the screen when they are hit.

    Hi all!

    I am a beginner on the development of blackberry, also a beginner in programming in general ^^

    I've done some app using just QML and take some C++ tutorials

    I try to get the coordinate of the screen when the user touches, I wasn't able to do that you use just QML, I found the source TouchEvent and tried to make it work on C++, to get the windowX and windowY coordinates of the touch.

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__touchevent.html

    I use the image on background to try to get contact with the event.
    So far, we have:

    PPS:

    class LostInSpace : public QObject
    {
        Q_OBJECT
    public:
        LostInSpace(bb::cascades::Application *app);
        virtual  ~LostInSpace() {}
    public slots:
    Q_INVOKABLE float screentouchY(bb::cascades::TouchEvent* event);
    Q_INVOKABLE float screentouchX(bb::cascades::TouchEvent* event);
    
    private:
    QPointer fundo;
    
    };
    

    CPP:

    LostInSpace::LostInSpace(bb::cascades::Application *app)
    
    {
    
        QmlDocument *qml =
    QmlDocument::create("asset:///main.qml").parent(this);
        qml->setContextProperty("app", this);
        AbstractPane *root = qml->createRootObject();
    
        app->setScene(root);
    
        fundo = root->findChild("fundo");
        bool res = QObject::connect(fundo, SIGNAL(touch(bb::cascades::TouchEvent*)),this, SLOT(screentouchY(bb::cascades::TouchEvent*)));
        Q_ASSERT(res);
        res = QObject::connect(fundo, SIGNAL(touch(bb::cascades::TouchEvent*)),
    this, SLOT(screentouchX(bb::cascades::TouchEvent*)));
        Q_ASSERT(res);
    
    }
    
    float LostInSpace::screentouchY(bb::cascades::TouchEvent* event) {
        return event->windowY();
    }
    float LostInSpace::screentouchX(bb::cascades::TouchEvent* event) {
        return event->windowX();
    }
    

    QML: (I'll do later animations, it's just to see if it works. I mean a "unknown simbol app" the Notecard, I thought I just had to put "qml-> setContextProperty ("app", this);  in the constructor)

    ImageView {
                    objectName: "fundo"
                    imageSource: "images/fundo1.png"
                    touchPropagationMode: TouchPropagationMode.Full
                    onTouch: {
                        tiro.translationX = app.screentouchX();
                        tiro.translationY = app.screentouchY();
                    }
                }
    

    Any help will be very appreciated!

    Thank you!

    Hey there,

    You don't need to do... You can access the 'event' TouchEvent object in the notecard: {} area QML...

    ImageView {
                    objectName: "fundo"
                    imageSource: "images/fundo1.png"
                    touchPropagationMode: TouchPropagationMode.Full
                    onTouch: {
                        tiro.translationX = event.windowX
                        tiro.translationY = event.windowY
                    }
                }
    
  • How to get the coordinates and the size of the swf to scale components

    I use the Web (I put it to the size of the entire screen) to frame a swfloader that loads a swf file with the width and height set to 100%. This swf has a movieclip. How can I get the exact coordinates of his position and its size after the scaling in Flex?

    In Flash CS4, the movielip a x = 40, y = 700. In Flex, the swf file is set to 100% scale, but when I get the x value of this movieclip, it is always 40. I try to get the scale of the x axis ratio using scaleX of swf. But his 1, pretty weird.

    How can I get the correct coordinates of the movieclip?

    The coordinates are usually compared to something.  X is relative to the parent.

    LocalToGlobal and globalToLocal convert coordinated areas.

    You can go to transform.pixelBounds and

    transform.concatenatedMatrix.

  • How to get the coordinates of the highest "current view" on the screen?

    Picture the following scenario:

    We have an application full screen has a vertical field with a few dozen Manager fields.   This screen will be much bigger, then the physical blackberry screen, scrolling, etc.

    What I need to findout corresponds to the vertical offset of 0 at the top of the visible display area.

    i.e.

    _____________<->

    ^

    Need to find this height

    v

    -----------------------

    visible area

    -----------------------

    ______________<>

    Is there something simple for this?

    getVerticalScroll seems to be.

  • How to get the FileSystemTree coordinates selected item?

    Hi can we idea me in how to get the coordinates of the itwn selected in a FileSystemsTree?

    THX

    g

    You should do something like this:

    var itemRenderer:DisplayObject = fileSystemTree.itemToItemRenderer (fileSystemTree.selectedItem) as DisplayObject;
    Contact information: Point = itemRenderer.parent.localToGlobal (new Point (itemRenderer.x, itemRenderer.y)) var;

    contact information is now an object point representing the coordinates of your itemRenderer in the global coordinate system.

  • How mode change and get the coordinates of the text frame?

    Hello.

    There are two questions.

    1. how to change fashion using JavaScript?  writing-> selection

    ->

    2. how to get the text frame coordinates?

    Thank you.

    1 app.toolBoxTools.currentTool = UITools.SELECTION_TOOL;

    2. f.geometricBounds (where f is your block of text).

  • How can I get the coordinates of the using block (TextFrame) text me please!

    MyApp as new Illustrator.Application Dim
    As Illustrator.Document Dim MyDoc
    myDoc = myApp.ActiveDocument
    Dim textRef = myDoc.TextFrames.Add


    For each ArtPageItems in myDoc.PageItems


    If TypeName (ArtPageItems) = "TextFrame" Then

    "=It is necessary to get the coordinates of the text block and to get closer to the subject (ie the text)="

    On the other
    End If
    Next

    for details of do

    If TypeName (ArtPageItems) = "TextFrame" Then

    x = ArtPageItems.Left

    y = ArtPageItems.Top

    On the other

  • How to obtain the coordinates of the cursor in a field in 3D?

    I have a land in 3D with discrete points. The cursor is indicated and broken so that I can move the cursor to select a point to the nearest point. I was wondering how can I get the coordinates of the cursor in the 3D plot so that I can point to the point (change the size or shape) which the cursor is located. I wasn't able to find coordinates using nodes property. Any suggestions will be appreciated. Thank you.

    Xueliang

    Is this working from home?

    This thread offers advice for hwo to use 3d graphics.

    http://forums.NI.com...=161218#M161218

    This an apperntly has an example to enter the values of the slider.

    http://forums.NI.com...=108612#M108612

    Ben

  • How to get the current location in the event thread?

    Hello!

    Can U pls tell me how to get the location where the thread object, it is in method() execution of MenuItem. PLS, tell me-

    I also used the different thread for the getLocation() method. But I do not have the coords of geo location...

    PLS, suggest me-

    My code is as below:

        private MenuItem getGeoCodes=new MenuItem("Current Coords",100,1){
    
                                 public void run(){
                                     double[] coords=getLocationCoords();
                                     this.wait(12000);
                                     System.out.println("Latitude :"+coords[0]+" "+"Longitude:"+coords[1]);
                                 }
    
                     };
    
        private double[] getLocationCoords(){
            Criteria criteria = new Criteria();
            criteria.setHorizontalAccuracy(500);
            criteria.setVerticalAccuracy(500);
            LocationProvider locationProvider = LocationProvider.getInstance(criteria);
            Location location=null;
            new Thread(){
               public void run(){
                       locationProvider.getLocation(60);
               }
            }
            QualifiedCoordinates qualifiedCoordinates=location.getQualifiedCoordinates();
            double[] coords=new double[]{qualifiedCoordinates.getLatitude(),qualifiedCoordinates.getLongitude()}   ;
             return coords;
        }
    

    But I myself NullPointerException. Coordinates get successfully, if we run the location capability in different function, rather than the event thread.

    Please help me-

    In my opinion, which may be too complicate things a bit. I think he's trying to do is register a LocationListener with his object of LocationProvider. Callback methods, send a message to the UI event thread as follows (no need to spawn threads):

    UiApplication.getUiApplication().invokeLater( new Runnable() {
        public void run()
        {
            // This code will execute on the event thread
        }
    });
    

    EDIT: If your interval is short, you can consider implementing this executable as a class and store an instance in the front.

  • How to get the text have the same effect as the video?

    Hello

    For the first time post here, but I wonder how to get the text of the titles have the same effect as the video behind her.

    For my video, I use 'bad tv' and other effects such as Gaussian that obviously changes the appearance of video, creating the look of VHS. However, I then inserted text via the title, but it normally appears. How can I make this text have the same effects as the video behind it?

    A friend told me I might need to add text to the video first, then do the effects, I have not tried, but wonder if there is an easier way, as this would require me to restart.

    EDIT: That's what I'm looking for. https://youtu.be/7_2PHQI89dI?t=24s The text has the same effect as the video.

    Thank you

    One way is to create a clip made up based on the title and the original clip. Then apply the effect.

    Another way is to use an adjustment layer.

    Good luck.

    Russ

  • How to get the podcast of the website on the phone

    I was told to put that feed into the PODCASTING app on your iOS device.

    The site in question is https://randirhodes.com/how-to-get-the-podcast/

    I paid for a premium podcast, now how o I get this podcast to appear on my iphone 6 s more in the podcast app?

    Podcasts > select my Podcasts > press the '+' > Add Podcast > paste the URL that you got on the site.

  • How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be.

    How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be. I started with the last update that I rebooted.

    Hello
    to change the homepage when opening firefox-press 'Alt' and click on tools-> Options.

    Main menu, you can change the URL.

    If the problem persists, you can follow these simple steps:

    Enter about: config in the address bar and press ENTER. Accept the message of 'dragons' to see the Advanced preferences screen. Use the above search box to enter the below pref.

    You can assign an empty string to stop your Firefox to retrieve "extracts" and brandLogo changes the browser.aboutHomeSnippets.updateUrl pref. Right-click this pref and select Edit then clear the value as pref in the box that appears, and then click OK. Who will also disable "snippets" that appear under the container of the research on the default home page.

    Then you must open the folder of your profile, via help > Troubleshooting Information > profile folder > > button view folder. Then close Firefox. Your profile file open with Firefox closed (Firefox '3-bar' menu key > exit/Quit), wait or two minutes, then remove the storage\moz-safe-about + home folder in the Firefox profile folder to remove the brandLogo and stored in IndexedDB code snippets to make Firefox use the default brandLogo and a defined default code snippet.

    If you later change your mind about these changes, you can reset the pref browser.aboutHomeSnippets.updateUrl via the context menu and Reset allows to retrieve the default value using the storage\moz-chest-fort-about + home folder again.

  • where and how to get the new Firefox add - one of who is spying on us. Please mail to...

    Heard speak adds the new on Fire Fox. Where and how to get the new Firefox add - one of who is spying on us. Please mail to maheshubhayakar at rediffmail.com

    edited by email address - moderator

    It is helpful if you provide a link to the article you were reading.

  • Re: How to get the Tempo to work properly?

    Hello

    I have problems with the service of Tempo.

    I don't get updates via this application (all the settings of this application are accurate, i.e. "full control"). I know this because there are updates available online to my laptop via the pilot site of toshiba.

    When I installed first Tempo, updates for about a month, I received, and then all of a sudden, no update came through. My firewall is blocking either of this application.

    I tried to reinstall the application, but no change in the situation.

    Does anyone know if ALL updates are available via the website of driver toshiba out tempo? Because, in the month that this service worked, I got an update of the bios, but I recently saw a bios update online and Tempo has not always reports that it is available.

    Any ideas on how to get the Tempo to work properly?

    Thank you.

    I saw in your other thread you have installed SP1 on your Vista laptop.
    There may be some compatibility problems between SP1 and Tempo

    And Yes, as far as I know Tempo bring all available updates!

Maybe you are looking for

  • 'Threading' has started on my incoming emails; How can I remove it?

    I want to see all my emails separately - not 'threaded' together in the subject line. I don't have a clue as to why - after years of use - thread just started a few days ago?

  • (HPE h8-1120 desktop computer) graphics card upgrade

    For now, I have a desktop HPE h8-1120 and there a GT 530. I want to upgrade to a better graphics card. I'll be able to upgrade to an EVGA GTX 670? (Will adapt and everything?) If so, what food should I upgrade to?

  • Satellite A300-17N cannot read CD

    * I have a problem with my optical dur.* It cannot read CD it can read DVDs. I tried to reinstall and I tried everything. It does not work. I Mat * a UJ - 850 s drive in Toshiba Satellite A300-17N on Windows Vista Edition Home Premium. Thanks for the

  • HP Pavilion G6 1d72nr: PCI device driver

    I just reinstalled windows 7 ultimate on my Hp pavilion laptop 1d72nr G6 and when I try to update all the drivers, it tells me that the PCI device is missing I try to update, but no luck here are my hardware ID PCI\VEN_10EC & DEV_5209 & SUBSYS_169510

  • After importing, movie seen side to the top down.

    I have imported a .mpg file, editing, the slice and add some transition to the film strip. After rendering, the residence permit but they film is backwards, i.e. rotation 360, why - what happens?