Finding coordinate of the line?

Here is my code. Here I make some drawing and transformation.
I have problem finding the coordinate of the line after I have done some transformation on it.
How should I code it so the program will let me know the start and end coordinate of the line once it's translated?
In this case, I want to find the coordinate "d". Coordinate a, b and c are given. (Pliz compile and run to be clear with it).
Thanks.
Chevas.
import java.awt.*;
import java.awt.geom.*;
import javax.swing.JComponent;
import javax.swing.JFrame;
public class TransformTranslatedRotation extends JComponent {
     public void paint(Graphics g) {
          double a[] = {50,90};
          double b[] = {150,70};
          double c[] = new double[2];
          double d[] = new double[2];
          c[0]= (a[0]+b[0])/2;
          c[1]= (a[1]+b[1])/2;
          System.out.println("a (" + a[0] + " , " + a[1] +")");
          System.out.println("b (" + b[0] + " , " + b[1] +")");
          System.out.println("c (" + c[0] + " , " + c[1] +")");
          Point2D.Double a1 = new Point2D.Double(a[0], a[1]);
          Point2D.Double b1 = new Point2D.Double(b[0], b[1]);
          Point2D.Double c1 = new Point2D.Double(c[0], c[1]);
          Point2D.Double d1 = new Point2D.Double();
          double dist_ab = a1.distance(b1);
          System.out.println("distance ab: " + dist_ab);
         Graphics2D g2 = (Graphics2D) g;
         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         g2.setPaint(Color.black);        
          g2.drawLine((int)a[0], (int)a[1], (int)b[0], (int)b[1]);
          g2.drawString("a", (int)a[0]-5, (int)a[1]-5);
          g2.drawString("b", (int)b[0]-5, (int)b[1]-5);
          g2.drawString("c", (int)c[0]-5, (int)c[1]-5);
          g2.drawString("d", (int)c[0]+15, (int)(c[1]*2.5));
         AffineTransform rat1 = new AffineTransform();
          System.out.println("tx: " + rat1.getTranslateX());
          System.out.println("ty: " + rat1.getTranslateY());
         rat1.rotate(Math.PI/2, c[0], c[1]);
         rat1.translate(c[0]-a[0],c[1]-a[1]);
         g2.transform(rat1);
         g2.drawLine((int)a[0], (int)a[1], (int)b[0], (int)b[1]);
          System.out.println("tx: " + rat1.getTranslateX());
          System.out.println("ty: " + rat1.getTranslateY());
     public static void main(String[] a) {
         JFrame f = new JFrame();
         f.getContentPane().add(new TransformTranslatedRotation());
         f.setSize(400, 300);
         f.show();
}

tx = Returns the X coordinate of the translation element (m02) of the 3x3 affine transformation matrix.
ty = Returns the X coordinate of the translation element (m12) of the 3x3 affine transformation matrix.

Similar Messages

  • Find Grep And Ignore the line break

    Hi Guys!,
    In my document having the text of "application \nfor you"
    Then, I need to ignore the line break in entire text indesign document.
    please help me!
    Thanks by
    John Peter.

    hi,
    I am find only words
    the line break wherever it is used in the document. so i am ignore the \n
    Document text : \napplication \nfor \nyou      ----this sentence contain many line breaks
    I will find the text of above document text.
    Find what of grep preferences: (application for you)(--here what to do for ignore \n)
    Please help me.
    thanks,
    John peter.

  • How to find end of the Page in Crystal ? or I need to add one Horizontal line at the end of the page.--- URGENT HELP NEEDED

    Hi friends,
    I need to add one horizontal line  for the detail section at the end of the page.
    I tried to put that line in page footer and i tried with Box also. Both are not properly working. Some space problem is coming.
    Is there any feature to find end of the Page.
    I want report format like this.
    set id  |  set name |  date  Name
      1         x           dddd   vijay
                            dddd   sarathi
                            dddd    reddy
    (End of the page)
    Thanks in advance...
    vijay.

    Do you know how many detail records are showing up per page?
    If you do - you could create a Details B section that is suppressed except for on Record N (where N is a counter, and N is the last Detail record that will show up on a page).
    The Page footer is indeed built so that it will be rendered at the bottom of your physical page of paper.

  • Module pool ---Problem in finding the line index for the table control

    Hi Friends,
    I am working in Module pool programming.
    My requirement is when i select any record on the lead selection I need to find out the index of the line on which  row i have selected.
    Could any one please suggest me the proper solution how to get the line index for the table control in module pool programming.
    Thanks
    Satish Raju

    Hi Raju,
    Follow the steps
    <li>U should take one variable in your internal table or in structure which is used for table control fields.
          DATA :BEGIN OF itab OCCURS 0 ,
                mark TYPE c ,
                matnr LIKE mara-matnr ,
                matkl LIKE mara-matkl,
                maktx LIKE makt-maktx,
            END OF itab .
       controls: tabc types tableview using screen 100.
    <li>This mark variable should be given in Table control properties. follow the path
    double click on the table control-->attributes .->select w/SelColumn and in that give itab-mark.
    <li>Flow logic of the screen
       process before output.
         MODULE status_0100.
         LOOP AT itab with control tabc
         endloop.
       process after input.
         module cancel at exit-command.
         LOOP AT itab.
           MODULE read_table_control.
         ENDLOOP.
         MODULE user_command_0100.
    <li>read_table_control module code
         MODULE read_table_control INPUT.
         MODIFY itab INDEX tabc-current_line."this will update the itab table
                                             "mark field with 'X ' whatever we
                                             "have selected on table control
         ENDMODULE.
    <li>If you want to Delete some of the records from Table control follow this code u2026Create one pushbutton and give Fucnction code to that and write below code
       CASE okcode.
         WHEN 'DELETE'.
           LOOP AT itab WHERE mark = 'X'.
             DELETE itab.
           ENDLOOP.
       ENDCASE.
    I hope that it helps you.
    Thanks
    Venkat.O

  • I can't find the line tool.  Where is it?

    I am new to Photoshop CS6.  I was using CS2.
    I can't seem to find the line tool.  Can someone please tell me how to get the line tool?
    Thanks,
    Gary

  • Find the coordinate of the transformation anchorpoint of a pageitem

    hi
    i developp an extension for indesign with CS extension builder 2 and flashbuilder 4.6 and i dont find the coordinate of the transformation anchorpoint of a pageitem. Where can i find this property ?
    thanks
    simon

    I moved this discussion to the scripting forum because it's not an SDK question.

  • How to find the lines where messages are raised?

    Hi experts,
    I have a great difficult to find some points where a message is raised.
    In GUI interface, we can use the u201CUsed-Listu201D option and the system show us the lines where the message is raised.
    In web-client, some good SAP programmers wrote the code u201Cif 1=2 message u2026u201D after he/she input message in the message manager classes (cl_bsp_wd_message_service, cl_crm_genil_global_mess_cont, etc). So the u201CUsed-Listu201D resource manages to find those points.
    However, some bad programmers didnu2019t do that and it is almost impossible to know where the message is raised in certain situation, though I have its message class name and its number, for instance, COM_PARTNER u2013 559.
    Is there any tip about how to find a calling point?
    Regards,
    André

    This will tell you the directory that contains the running program:
    System.getProperty("user.dir")

  • In the read_text function module,  how to find the  lines

    The coding follows like this,
    call function 'READ_TEXT'
           exporting
                client                  = sy-mandt
                id                      = id
                language                = sy-langu
                name                    = name
                object                  = object
           importing
                header                  = header
           tables
                lines                   = tab
           exceptions
                id                      = 1
                language                = 2
                name                    = 3
                not_found               = 4
                object                  = 5
                reference_check         = 6
                wrong_access_to_archive = 7
                others                  = 8.
    can u provide me with the correct data form which i can read the lines.

    I think this code will help you to read the lines
    *--LOCAL VARIABLES
      DATA : LV_NAME TYPE THEAD-TDNAME,
             LV_TEMP(128) TYPE C      ,
    *--Structure to Hold the Header Data for Func Modules
    *--Read_text
             X_HEADER TYPE THEAD      .
      CLEAR  : LV_NAME     ,
               LV_TEMP     ,
               V_IND_FG    ,
               X_HEADER    ,
               IT_TLINES   ,
               IT_TLINES[] .
      LV_NAME  = P_DELV_NO .
      X_HEADER-TDOBJECT = 'VBBK'.
      X_HEADER-TDNAME   = LV_NAME .
      X_HEADER-TDID     = 'ZMAN'.
      X_HEADER-TDSPRAS  = 'E'.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
                CLIENT                  = SY-MANDT
                ID                      = X_HEADER-TDID
                LANGUAGE                = X_HEADER-TDSPRAS
                NAME                    = X_HEADER-TDNAME
                OBJECT                  = X_HEADER-TDOBJECT
           TABLES
                LINES                   = IT_TLINES
           EXCEPTIONS
                ID                      = 1
                LANGUAGE                = 2
                NAME                    = 3
                NOT_FOUND               = 4
                OBJECT                  = 5
                REFERENCE_CHECK         = 6
                WRONG_ACCESS_TO_ARCHIVE = 7
                OTHERS                  = 8.
      IF SY-SUBRC <> 0.
         ERROR.
        CLEAR :IT_TEXT,
               IT_TEXT[] .
        V_IND_FG = 'X' .
        EXIT .
      ENDIF.
      LOOP AT IT_TEXT .
        IT_TLINES-TDFORMAT = '*'.
        IT_TLINES-TDLINE = IT_TEXT-LINE.
        APPEND IT_TLINES.
        CLEAR  IT_TLINES.
      ENDLOOP.
    Thanks,
    Koshal

  • How to find out the line which caused the runtime error in a SP?

    We have a situation like this.
    We are consulting company doing consultancy services on Oracle technologies.
    One of our clients have PL/SQL stored package.
    We found out by debugging the Oracle Forms front-end application that
    error is generated by a procedure inside this package.
    Problem is that this procedure has over 6000 lines.
    How do we figure out the line which caused the error?
    We tried putting messages in between, but not have been successful.
    Any help would be greatly appreciate.

    How do we figure out the line which caused the error?
    We tried putting messages in between, but not have been successful.
    What does that mean exactly?
    Typically you would instrument the code (especially for multi-step ETL/transform processes) to capture/log key information.
    Also, key sections of code would also be in their own BEGIN/EXCEPTION/END block so that you would know what block caused the exception.
    step_num NUMBER; -- what step is being executed?
    BEGIN
      step_num := 1;
      . . . do something
      step_num := 2;
      . . .  do something else
    EXCEPTION
      -- when you get here the 'step_num' variable will have the number of the step that caused the exception. Log it and then handle/reraise it.
    END;

  • How to find the line no.

    I am parsing an xml document and doing its custom validation (i.e putting in my own constraints).so can i notify on which line no. of the xml document is the error present?if yes how?

    Rather than worry about a Locator, if you know the row number and column number where the problem occurs, how about using the non-locator constructors, such as:
    public SAXParseException(String message,
    String publicId,
    String systemId,
    int lineNumber,
    int columnNumber)
    Create a new SAXParseException.
    This constructor is most useful for parser writers.
    If the system identifier is a URL, the parser must resolve it fully before creating the exception.
    Parameters:
    message - The error or warning message.
    publicId - The public identifer of the entity that generated the error or warning.
    systemId - The system identifer of the entity that generated the error or warning.
    lineNumber - The line number of the end of the text that caused the error or warning.
    columnNumber - The column number of the end of the text that cause the error or warning.
    Then you can do something like:
    String msg = "complaint about the problem";
    String fn = file.getPath(); /* or some string description of the file/stream you
    are processing */
    throw new SAXParseException( msg, fn, fn, row, col );Then, in your ErrorHandler implementation, you can use code like:
        /** Returns a string of the location. */
        private String getLocationString(SAXParseException ex) {
            StringBuffer str = new StringBuffer();
            String systemId = ex.getSystemId();
            if (systemId != null) {
                int index = systemId.lastIndexOf('/');
                if (index != -1)
                    systemId = systemId.substring(index + 1);
                str.append(systemId);
            str.append(':');
            str.append(ex.getLineNumber());
            str.append(':');
            str.append(ex.getColumnNumber());
            return str.toString();
        }Dave Patterson

  • Is it possible to find and retrieve the pixel coordinates of a polygon image? Perhaps using Magic Wand and Paths?

    THANK YOU!

    Hi Mylenium,
    I want to create a complicated polygonal hotspot around the map of many countries of the world in Dreamweaver (eg. a hotspot around the US border), but don't want to spend the time tediously selecting the coordinates around the border.
    i.e. the code in Dreamweaver would be something like this
    <area shape="poly" coords="5,343,18,340,38,327,71,314,88,304,75,302,63,301,46,301,58,290,58,284,40,292,36,28 1,43,276,47,263,62,257,91,244,99,244,113,237,132,235,146,226,155,222,131,221,102,223,106,2 06,151,197,153,202,164,203,178,198,187,198,181,189,176,187,170,173,185,166,209,162,229,154 ,253,146,280,143,307,142,321,136,354,143,374,145,404,150,429,149,440,155,314,259,304,268,2 94,276,302,281,310,278,308,288,311,296,328,292,338,284,342,290,340,296,341,310,335,325,342 ,335,346,341,342,345,333,351,327,357,321,343,324,340,316,323,321,318,318,306,307,307,298,2 87,274,282,252,280,238,272,236,268,212,273,209,283,164,294,187,274,132,295,128,301,32,338, 18,346" href="/UnitedStates.html"
    Is there a way to use Photoshop's magic wand tool / slice / path tool to extract the coordinates of an images border for me?
    Thanks

  • Find the LINE FEED and replace it.

    Hi
    I am using ORACLE 11g R2. I am having some text data in a variable as below :-
    Variable = V_TEXT
    V_TEXT :=
    '/u01/oracle/data/file1.txt
    /u01/oracle/data/file2.txt
    /u01/oracle/data/file3.txt'I want to place an '|' (pipe symbol) at the end of each line. So the expected output is as below :-
    '/u01/oracle/data/file1.txt|
    /u01/oracle/data/file2.txt|
    /u01/oracle/data/file3.txt|' I tried with replace() function and replaced return character i.e. CHR(10) with '|' but it gives me an wrong output and also at the end of last line we dont have an return character.
    after searching a lot on internet I found that i can do this with the help of regular expression.
    As far as i have studied : -
    The line feed character is the last character in the line or we can say it is end of line. This character is noted in oracle as 'x0a'
    I want to replace this character in every line and place an '|' symbol.
    can anyone guide me how to do it ??
    Thanks in advance.

    Aha... Now that is a different expected output as in your original post ;-)
    One way of doing it could be something like this:
    declare
      v_text varchar2(32767) := '/u01/oracle/data/file1.txt
    /u01/oracle/data/file2.txt
    /u01/oracle/data/file3.txt';
    begin
      v_text := regexp_replace(
                   regexp_replace(v_text,chr(10)||'\s*'||chr(10),chr(10))
                 ,'$','|',1,0,'m'
      dbms_output.put_line(v_text);
    end;
    /Inner regexp replaces "linefeed followed by zero or more whitespace followed by linefeed" with a single linefeed. So this removes the blank lines.
    Then the outer regexp takes care of the | characters.
    (It might be possible to wrap it up in a single regexp, though I can't think of a way just off hand ;-) )

  • HT3625 i can not see the line in/built in input on the menu?do you know why?

    i can not see the line in/built in input on the menu?does anyone know why?
    i am trying to broadcast a live dj mixing but with the set up, i cant find the lin in input not even on the menue.
    any clues will be appreciated.

    see shots from '11 to '12 going forward.

  • I have files that may have been created in various versions of Illustrator. We need to be able to open them, but all we have is CS6 suite. I have called and been told that "technicians at adobe" could perform a paid service to find out what the files were

    I have files that may have been created in various versions of Illustrator. We need to be able to open them, but all we have is CS6 suite. I have called and been told that "technicians at adobe" could perform a paid service to find out what the files were created in and get them to be useable in InDesign 6, but I'd need an email address that was registered to our software to give the help desk person. After finding the correct email address, different adobe help number people told me to come here to ask as there is no phone support. Can anyone get me to an adobe technician that can provide a price quote for finding out what created these files and for getting them converted? Thanks.

    Sorry, I understood you to say you had the whole CS6 suite, which includes Illustrator.
    As far as finding out what the files are, sometimes you can look at them in a text editor to figure this out. See below; the, Creator Tool line. Not every software package makes it this easy, though.

  • Find and edit specific line in text file?

    Hello I want to read a text file that could look in some different ways since the user choose file from a list. I then want to igonre all the lines that begin with a special character, for example %. I then want to find all the lines "words" that begin with TRY for example and put those "words" in a string or array. If there is one line that contains TRY100 and anoter line that contains TRY200 I want to find those words and display them. How do i do this?

    First you read the entire file.  Use the Read Text File.  Right-click on it and select the option to Read Lines.  The the count to read to -1 (read all).  You will now have an array of strings, one item for each line of your file.
    Now you need to play the filter game.  I recommend using FOR loops with Autoindexing tunnels.  Assuming you are using 2012 or later, have the output autoindexing tunnels use the conditional tunnel.
    Give this a try and see where you can go.  Post back with what you have tried and tell us where you are stuck.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • File does not exist :C:/oracle/product/10.2.0/db/apache/apache/htdocs/emd/m

    Dear All, unable to Login on Logging into Apex Login Page, in Apache Log the Following Error is found [ecid:1213173391:172.20.233.149:1788:1840:1.0] File does not exist :C:/oracle/product/10.2.0/db/apache/apache/htdocs/emd/main/ what cud be the Probl

  • Taglib problem: Cannot parse custom tag with short name table

    Hello! I am having problems deploying a jsp tag in web as. The same war file works fine on websphere, jboss. SAP web as seems to be complaining about the short name in the tld. Can any body me to any known web as issues with jsp tags? Thanks [code] A

  • Error in passing parameter between 2 jsp..

    Hi.. I have error in when submitting a jsp to another jsp.. It seems like cannot get the values i put in the first jsp... The first jsp codes.. <FORM name="mank" action="<%= HttpPortletRendererUtil.htmlFormActionLink(request, PortletRendererUtil.PAGE

  • Exporting a large filtered list to Excel

    I have a list that has approx 9600 items.  List view threshold is set to 5000.  The list view has a filter on it which in the browser is only displaying around 100 items. However, at the top of the list it displays "Displaying only the newest results

  • What is SAP best practice for SU24 "no check" indicators

    Hi Experts, Let's say during testing if we find a t-code needs some authorization objects for end to end execution, and those objects are maintained as "CHECK" "NO" in USOBX_C. Please suggest the best practice... Should we change the proposal in USOB