Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: getting the intersect value of x and y axis of a 17X17 matrix

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default getting the intersect value of x and y axis of a 17X17 matrix

    Hello, Please I'm working on an SE application that requires me generating and populating a matrix with a set of characters which I have done, I have a challenge returning the character where the x and y coordinates of the matrix intersects.
    see image attachmentScreen Shot 2019-02-18 at 4.57.53 PM.jpg. many thanks

  2. #2
    Junior Member
    Join Date
    Feb 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default getting the intersect value of x and y axis of a 17X17 matrix

    Hello, Please I'm working on an SE application that requires me generating and populating a matrix with a set of characters which I have done, I have a challenge returning the character where the x and y coordinates of the matrix intersects.
    see attachment belowScreen Shot 2019-02-18 at 4.57.53 PM.jpg many thanks

  3. #3
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: getting the intersect value of x and y axis of a 17X17 matrix

    To access an array, x and y are the "row" and "column" of the array.

    a = MyArray[row][column];

    And please don't post images as they are hard to read. Just describe the array you are working with.

    Regards,
    Jim

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,322
    Thanks
    53
    Thanked 2,392 Times in 2,346 Posts

    Default Re: getting the intersect value of x and y axis of a 17X17 matrix

    I have a challenge returning the character where the x and y coordinates of the matrix intersects.
    Please explain. How is the matrix defined? What are the x and y coordinates with respect to the matrix?

    Also post the code you are using to solve the problem. Be sure to wrap the code in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: getting the intersect value of x and y axis of a 17X17 matrix

    the image attached to the question represents the matrix in question while the values in red on the columns (F to 0) serve as the y coordinates and the values in red on the row (0 to F ) serves as the x coordinates.
    For the codeblock, honestly I have not written nor tried any I searched for API's that have the ability to do that but to no avail, I guess I posted in the wrong forum and having difficulties changing it

  6. #6
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: getting the intersect value of x and y axis of a 17X17 matrix

    The x and y rows are in hexadecimal. They go from 0(0) to F(15). So your array is 16 x 16. You can index the array by simply using values of 0 thru 15 like I described before. If you are presented with hexadecimal values in the form of a String you can convert them to decimal yourself or use one of the Integer class static methods to do so.


    Edit: Your actual data part of the array is 16 x 16 but with the row and column designators (if you included them) it would be 17 x 17. Also, I didn't catch that the y index (rows) go from F to 0 so you would have to index them backwards (this is why I don't like images because they are hard to read).

    Regards,
    Jim
    Last edited by jim829; February 18th, 2019 at 11:27 AM.

  7. #7
    Junior Member
    Join Date
    Feb 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: getting the intersect value of x and y axis of a 17X17 matrix

    thanks Jim, I will get back to you

    --- Update ---

    thanks Jim your solution worked like charm!

Similar Threads

  1. Collision Detection using SVGPath.intersect
    By KillahByte in forum JavaFX
    Replies: 1
    Last Post: November 8th, 2017, 03:21 PM
  2. [SOLVED] Moving object in the y-axis
    By Flcha in forum What's Wrong With My Code?
    Replies: 13
    Last Post: July 11th, 2014, 12:38 PM
  3. Knapsack problem , check if matrix can fill list of smaller matrix list.
    By ofirattia in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 8th, 2012, 12:20 PM
  4. Project - Manipulating ArrayList (Union, Intersect, etc)
    By NewStudent709 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 17th, 2012, 01:56 PM
  5. Replies: 7
    Last Post: June 26th, 2011, 11:16 AM

Tags for this Thread