How to obtain corner points of rotated rectangle?

Am drawing a rectangle, then using an Affine Transform to rotate the angle. After rotating and drawing the rectangle, I need to obtain the 4 corner points of the rectangle. This is (psuedocode) for what I've tried:
Rectangle r = new Rectangle (x, y, width, height);
AffineTransform at = new AffineTransform();
at.rotate (angleInDegrees*Math.PI/180);
Shape s = at.createTransformedShape (r);
PathIterator pi = s.getPathIterator(at);
while (pi.isDone() == false)
fetchCornerPoint (pi);
pi.next();
g2.draw(s);
The shape is being correctly drawn on the screen, so I know the transofmr is working. But the path appears to contain the 4 corner points of the rectangle prior to rotation, not the 4 corner points after the rotation.
It's got to be a "doh moment", but I can't see it.

I notice you call getPathIterator on 's', which is already transformed. I have not verified this, but maybe you should call getPathIterator(at) on the original shape ('r')?

Similar Messages

  • How to obtain JNIEnv pointer and jobject reference in arbitrary contexts?

    Hi,
    I need your hand. How to obtain JNIEnv pointer and jobject reference in arbitrary contexts? (See below source codes for details)
    I made some tries according to JNI spec, but still failed to get it work. Could you please provide your solutions? Better show me some source codes.
    Thank you very much !!!
    #include <jni.h>
    #include "MessageThread.h"
    #include "MyServer.h"
    // this is callback function called by the native C++ library
    void processEvent(int progress)
       in this function, i want to get "env", "obj" ( HOW? ),
       then i can do below to invoke Java function "updateUI":
       cls = env->GetObjectClass(obj);
       mid = env->GetMethodID(cls, "updateUI", "(I)V");
       env->CallVoidMethod(obj, mid, progress); 
    JNIEXPORT void JNICALL
    Java_MessageThread_handleMessageQ(JNIEnv *env, jobject obj)
      MyServer* server = MTMServer::Instance();
      if (server != NULL)
        // must register a callback function before "QueryProgress"
        server->RegisterCallback(processEvent);
        // query message within a loop, and callback "processEvent" frequently
        server->QueryProgress();
      return; 
    }

    jschell, thanks for your suggestions.
    And caching the second is definitely wrong. Arguments are passed as local references. The reference lifetime is only guaranteed for the lifetime of the method call.In my case, it just works, because my "callback" is only called before the "handleMessageQ" returns, which means it's within the lifetime of "jobject", etc.
    Use GetEnv to get the environment.Could you please provide some sample codes?
    Create a static java method which returns the object reference. In your callback call that method to get the reference that you want to work with. I didn't really understand. Could you please show me some sample codes?
    Thanks a lot!

  • How to change decimal point in Rotate Tool.

    Hi,
    I use the rotate tool to design gauges, like clocks, a lot. I hold the ALT button and click on the center of my drawing and then a window pops up to enter in what degree I want my object to be. Currently the decimal point only allows for hundredths, ex. 45.25 degrees. Is there any way to change this to thousandths or even higher, ex. 45.25125? I've attached a screenshot to show you what I mean.
    Any help would be appreciated!
    Thanks,
    Laura

    Laura Belle,
    When you enter the full decimal value, that should give you the right rotation whatever the truncated value is.
    At least I hope that is still the case in your version.
    You may test it as follows:
    1) Create a square with W = H = 100;
    2) Rotate thrice, each time inserting 33.333333 degrees, then rotate by -100 degrees;
    3) Look at the W and H values;
    4) Repeat 1) - 3), only with 33.33 degrees and see what you get.
    You should get W = H = 100 in 3) and  something like 100.017 to 100.018 in 4).

  • How to obtain SPRuntime pointer?

    Hi,
    In Adobe Dialog Manager documentation there is such code snippet:
    SPErr error = kSPNoError;
    SPHostProcs *gHostProcs;
    error = sSPRuntime->GetRuntimeHostProcs(&gHostProcs);
    if (!error)
    gHostProcs->startupNotify(kSetMessage,
    (void*)"Initializing QuickDraw 3d", gHostProcs->hostData);
    What is the way from plugin code to obtain that sSPRuntime pointer?

    jschell, thanks for your suggestions.
    And caching the second is definitely wrong. Arguments are passed as local references. The reference lifetime is only guaranteed for the lifetime of the method call.In my case, it just works, because my "callback" is only called before the "handleMessageQ" returns, which means it's within the lifetime of "jobject", etc.
    Use GetEnv to get the environment.Could you please provide some sample codes?
    Create a static java method which returns the object reference. In your callback call that method to get the reference that you want to work with. I didn't really understand. Could you please show me some sample codes?
    Thanks a lot!

  • How to obtain coordinates of each point in a polygon?

    How can we obtain the coordinates of each point in a polygon (say 6 sides)?
    Using pageitemref I had used GetPathBoundingBox method of IGeometry to get a PMRect as follows:
    InterfacePtr<IGeometry> geometry(pageitemRef, UseDefaultIID());
    geometry->GetPathBoundingBox(::InnerToPasteboardMatrix(geometry));
    I am only able to get the leftTop, rightTop, etc. of the frame that contains the polygon.
    How to obtain the coordinates of each point in a polygon?

    Hi,
    you can use the IPathGeometry interface.
    Markus

  • How can I disable making live shape rectangle in the first place but normal one instead in Illustrator CC?

    How can I disable making live shape rectangle in the first place but normal one instead in Illustrator CC? When I create rectangle I can't transform it by dragging and it's only the problem with rectangle, not with circle, star etc. I try show/hide edges/bounding box reset preferences and reinstall whole illustrator CC and it's the same. I can only make this right by expand this rectangle, which is shape as is turn out to rectangle by clicking object>shape>expand rectangle. But this is so frustrating. Help!:) oh, and I use OSX. My friend has the same specs and it's works. I mean she can use live shape corner transformations and changing size by draging:(

    I’ve created my own plugin (available for free for personal and commercial use) which imitates behavior of the ‘old’ Rectangle Tool. It doesn’t replace the Live Rectangle – it works completely independent!
    My Plain Rectangle Tool correctly snaps to grids/objects/points and correctly aligns to grid/points on resize. Of course it supports the SHIFT and ALT/OPTION keys, Snap to Grid and Smart Guides options. In other words it works almost 100% the same as the Rectangle Tool we know from CC (17.1), CS6 and earlier.
    The installation package (zxp) adds ‘Plain Rectangle Tool’ icon into the Ai panel (of curse you can assign your custom keyboard shortcut to it as well)
    Note: The Plain Rectangle can be easily converted into the Live one using Object > Shape > Convert to Rectangle
    Grab your copy at http://63mutants.com/subc/products/PlainRectangleTool_m01/PlainRectangleTool_m01.php Feel free to share with your friends. It’s completely free.
    I’ve also created a separate discussion https://forums.adobe.com/thread/1587587 for the Plain Rectangle Tool. If you have any comments or request please post it there. Any feedback would be greatly appreciated!
    Thanks,
    Pawel Kuc

  • Why do my corner points have curves?

    Here's the problem:
    I select the Pen tool in InDesign CS in Document A. I click at a certain spot, move and click again, move and click again. The resultant two-segment line has a curve at the corner point. Nothing I do can remove that curve.
    When I try exactly the same thing in a new document, Document B, the curve is not there.
    What settings have I got in Document A that causes this and how do I change those settings?
    Document A can be downloaded here:
    http://www.mediafire.com/?0njedxovgyn
    It's blank, except for the three corner points.

    > Now that brings up another point: at no stage did I select 'rounded corners' when using the Pen tool, though I have used rounded corners for image frames. Doesn't seem quite right to me that an option applied to one type of object should automatically be applied to every other type. So I have a question:
    > Is it possible, at some stage during the use of a tool, to force it to its default settings? For example, you can force a Paragraph Style to its default settings (and remove any overrides) by holding 'Option' when clicking on the style. Can a similar method be used with other tools?
    You're making a common mistake. The Object Styles and default settings for objects are not applied to
    i tools.
    They are applied to
    i objects.
    The Pen tool does not create Pen objects. It creates objects that are styled with the Basic Graphic Frame object style.
    There are six tools that use the Basic Graphic Frame object style as the default style for the objects they create: Pen tool, Pencil tool, Rectangle tool, Ellipse tool, Polygon tool, and Line tool.
    Therefore any change to the default Basic Graphic Frame style will apply to all objects created with these tools. (It can be confusing to realize that the lines created with the Line tool have rounded corners if Corner Effects have been applied to the style. Especially since there are no corner points in the lines to display the corner effects.
    Furthermore, there is a big confusion as to what these objects are. The name of the default style for these objects is Basic Graphic Frame.
    b But these objects are not Graphic frames. They are Unassigned frames.
    This is the big confusion for me when I teach as the word "Graphic" in the style name is not applied to Graphic frames.
    In fact, the objects created by the Rectangle
    i Frame
    tool, the Ellipse
    i Frame
    tool, and the Polygon
    i Frame
    tool, are all created with the None Object Style attribute.
    The default for the None setting for those tools is always Fill: None, Stroke: None. And while it is possible to apply a local override to the None style, you can't modify it (as far as I know) to be different.
    But remember, it is those three tools that create
    i Graphic
    frames.
    b You would think that Graphic frames would have the Basic Graphic Frame object style applied.
    But you would be wrong.

  • IMAQ ROI rotated rectangle ANGLE calculation

    I am using IMAQ Construct ROI to construct a rotated Rectangle ROI. The resulting contours give coordinated of the top and bottom points of the rectangle before rotation and a fifth number indicate the angle. But can anyone tell me how can i calculate the angle in degree from this value, so that i can calculate the exact points of the rotated rectangle?
    Is there any other method to find the actual coordinates of the 4 edges of the rotated rectangle? My intention is to find some points in between these edge points, which i can calculated with simple trigonometry by knowing the angle of rotation. 
    Thank you in advance,
    Mathew

    The angle of rotation is about the center of the rectangle.  I think the angle is already degrees.  If you calculate the center of the rectangle and subtract it from the corners, you have the coordinates to be rotated.  The easiest way I have found to rotate coordinates is to convert them to a complex number, multiply the complex number by the angle IN RADIANS, then convert back to x, y.  Add the center of the rectangle back to the rotated coordinates and you are done.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • How to obtain a case number for License transfer process

    How to obtain a case number for License transfer process.

    Good to know - Here you have the user-2-user forum for "Adobe Reader".
    For anything "License" related you will want to be using the "contact" feature to meander about until you can get a "licensing work group" point of contact.
    The path starts here:
    Contact Customer Care
    Be well...

  • A very simple question: how to obtain the mail server name?

    In our JSP application, at one point an email will be sent to notify one event. Currently, that is done by using the html tag: mailto. To have more control on the email in tems of context format (a bad layout right now) and others. I would like to have it processed at servlet by using the JavaMail API, so that it have a nice format and have the sender's email address right in case email client is not installed in the machine where the browser in. The JavaMail API is straight forward. The question is how to obtain the mail server name, and the sender's email address if there is one?
    Thanks.
    v.

    How to obtain the mail server's name? It's your server, you should know its name. Or if it isn't your server, you should ask the administrator for its name. Point is, you need to decide in advance what server you are going to use and hard-code its name into the program or into a properties file.
    And how to obtain the client's e-mail address? You have to ask the client, probably by putting a box in the HTML and asking them to type it.

  • Pivot Point in "Rotate 3D"

    hi all,
    is there a way to change the pivot point in "rotate 3d" (timlines/add action)?
    i have no problems to set a new pivot point with the transform/rotate tool. works well.
    but in rotate 3d it rotates around the center of the object.
    an example, think of a picture that rotates around a pole.
    have a creative day

    Thank you for the reply.
    Unfortunately it doesn't answer my question.
    I DONT want to animate rotating around the center. I have offset the pivot of an object and rotated around that from state 1 to state 2. But the animation interpilation ignores this and still rotates around the center of the object to get from state 1 to 2.
    I want the object to swing in to the canvas from its bottom corner but I can't get it to honor where I put the pivot during the actual build of animation.
    I am beyond frustrated with the limitations of Catalyst. If I have to go to Flash Builder to add any type of specific function, whats the point, as FB
    is 10 times more complex to me than Flash ever was. The reason I am not messing with Flash is that I don't want to screw with code.
    but I guess I might as well just stick with Flash as in Catalyst
    I can't
    Use Gifs
    Animate around a changed pivot
    Scale a bitmap thats a button (come on really...)
    Unreliable results with swf files that have multiple bitmap images in them.
    Any type of slightly advance animation, such as ...move a background around to loop,  when I am in a static state.

  • How would I go about adding multiple rectangles using the same lines of code?

    How would I go about adding multiple rectangles using the same lines of code? I would prefer to just run through a set of code every time I need a polygon. If I just have to create multiple polygon adding statements that's fine but I'd prefer just 1.

    >>How would I go about adding multiple rectangles using the same lines of code?
    You could create a method that creates and returns x number of Rectangle elements:
    public IEnumerable<Rectangle> CreateRectangles(int numberOfRectsToCreate)
    for (int i = 0; i < numberOfRectsToCreate; ++i)
    Rectangle rect = new Rectangle();
    rect.Fill = Brushes.Blue;
    rect.Width = 100;
    rect.Height = 100;
    yield return rect;
    ..and then call this method from anywhere in your code:
    IEnumerable<Rectangle> rects = CreateRectangles(5);
    foreach (Rectangle rect in rects)
    //add to StackPanel or do whatever with the Rectangle elements:
    yourStackPanel.Children.Add(rect);
    >>If I just have to create multiple polygon adding statements that's fine but I'd prefer just 1.
    When adding Point objects to a Polygon you can only add one per call to the Add method but you could call the Add method inside a loop, e.g:
    for(int i = 0; i < 10; ++i)
    //add to StackPanel or do whatever with the Rectangle elements:
    Polygon p = new Polygon();
    p.Points.Add(new Point());
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't post several questions in the same thread.

  • Transformation point for rotation

    Before in flashMX the transformation point of rotation was BY
    DEFAULT at the 0, 0 (or point of origin) in a symbol.
    This alone left the use of rotation in tweening fluent and
    easy but now in Flash 8 professional, it as the weird tendancy to
    center itself BY DEFAULT and returning to 0,0 only if I start a
    transformation and double-click on the transformation point.
    I want to know how I can BY DEFAULT put this transformation
    point to 0,0 because this is increasingly annoying when you have a
    lot of symbol to work with.
    Thank you

    OmniFlash,
    > but now in Flash 8 professional, it as the weird
    tendancy to
    > center itself BY DEFAULT and returning to 0,0 only if I
    start
    > a transformation and double-click on the transformation
    point.
    When you convert shapes or images to a symbol, you'll see a
    3x3 square
    filled with 9 tiny squares. These allow you to determine the
    default
    registration point for that particular symbol. The convert
    dialog will
    remember settings from last time, so if you click the
    upper-left square
    once, you'll be set.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Coordinates of rotated rectangle

    I have a rectangle that is rotated by a script.
    When outputting the geometric bounds of the rectangle, I get the coordinates of the outside rectangle that is aligned horizontally.
    How can I get the actual coordinates of the rotated rectangle?

    Here's a basic example of using resolve()
    Note: This will only work if your object is (directly) on a page. Generalizing it to work whether it's on a page or a spread is very hard, and I don't have the time right now to break my head over this...
    var coord = getPointCoordinates(app.selection[0],AnchorPoint.TOP_LEFT_ANCHOR);
    alert(coord);
    function getPointCoordinates(obj,anchorPoint){
        var oC = obj.resolve(anchorPoint,CoordinateSpaces.SPREAD_COORDINATES);
        var page = obj.parentPage;
        var pC = page.resolve(anchorPoint,CoordinateSpaces.SPREAD_COORDINATES);
        return [oC[0][0]-pC[0][0],oC[0][1]-pC[0][1]];
    HTH
    Harbs

  • Change corner radius of rounded rectangles after drawing them

    It is great that vector shapes feel even "smarter" in CS6, allowing you to change the stroke width and color after drawing them.
    Designing user interfaces, I use a lot of rounded rectangles, and I often have to change the corner radius of a rounded rectangle that I've drawn by a pixel or two. Rather than having to trash the original shape and making a new one, it would be great if you could select the existing rounded rectangle and change the corner radius. I realize that there is a dilema: the user is technically free to move anchor points around and change the object from a rounded rectangle; but Photoshop could basically keep track of whether or not the shape's anchor points have been modified, and whether or not it should still be classified as a rounded rectangle.
    Alternatively, this might be an even better solution: rather than having the rounded rectangle be its own shape tool, as it currently is, just give users the rectangle tool, and let them adjust the corner radius of a rectangle at any time in the tool's options bar. The rounded edges of the rectangle would technically not be created with anchor points, it would be more like a smart effect that Photoshop is performing by rounding the edges. Another benefit of this would be that you could free tranform the rectangle, and the rounded corners would not get screwed up as they currently do, because Photoshop knows that this is just a rectangle shape that you always want to have rounded corners on.

    Oh thanks for the heads up, I had not seen the Photoshop GetSatisfaction page before. Here is a topic with the idea: http://feedback.photoshop.com/photoshop_family/topics/it_would_be_good_if_the_roundrect_ve ctor_tool_corner_radius_was_editable_during_and_after_drawing
    Vote it up people.

Maybe you are looking for

  • Transaction for characteristics per plant / order type

    Transaction for characteristics per plant / order type We need a new transaction for customizing feature Characteristics per plant and order type ZVP_PRNTCHARCON example one screen - one dimension characteristics, other 15 operations Thanks

  • "An iPod has been detected, but it could not be identified properly" error

    We have had five iPod Nano's installed via our home computer (Dell PC - Windows Vista): one 2nd generation (currently being used) one 3rd generation (not in use - was lost) one 4th generation (not in use - was stolen) two 5th generations (currently b

  • Action links resulting in "Error Codes: QM3V3HLV" - OBIEE11G

    Hi, We have recently upgraded our 10g webcat to 11.1.1.5. Everything is working fine. But the action links on the dashboard page are resulting in the below error, when clicked for the first time. Invalid path () -- not allowed to be empty Error Detai

  • How to create Dev, Test and UAT environment of OAS 10g on single Linux box

    Hi According to Paul's forms/reports installation thread, i installed standalone versions of Forms & Reports (10.1.2.0.2)services on Linux suse 9. And it is working fine. Now my next requirement is that i want to create three environment on my Linux

  • The use of transaction VOFM

    Hi all, The above transaction is used to created (among other things) to use ABAP code to manipulate the values on a condition record. The calculation routine no. is attached to the condition and the code is executed. So far so good... My question is