Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8134527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:03:59+00:00 2026-06-06T10:03:59+00:00

Say each pixel in this picture(fig 1) is an element in an array. How

  • 0

Say each pixel in this picture(fig 1) is an element in an array. How would I rotate it 90 degress counter-clockwise(fig 2) and invert it vertically(fig 3)?

figure 1:
fig 1

figure 2: fig 2

figure 3: enter image description here

My current codes are:

private static Color[][] invert(Color[][] chunk){ //same as rotate
    Color[] temp;
    for(int i=0;i<chunk.length/2;i++){ //reverse the data
        temp=chunk[i];
        chunk[i]=chunk[chunk.length-i-1];
        chunk[chunk.length-i-1]=temp;
    }
    return chunk;
}

private static Color[][] rotate(Color[][] chunk){
    int cx = chunk.length;
    int cz = chunk[0].length;
    Color[][] rotated = new Color[cz][cx];
    for(int x=0;x<cx;++x){
        for(int z=0;z<cz;++z){
            rotated[z][x]=chunk[cz-z-1][x];
        }
    }
    return rotated;
}

The invert does the same function as the rotate though. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:04:00+00:00Added an answer on June 6, 2026 at 10:04 am

    seems like you are trying to transpose the array (fig3 = transpose(fig1)).

    use a double for loop and save in the entry [i][j] the value of [j][i].

    see LINK for more information on the matrix transpose…

    so all in all, you can use transpose to get fig3 and afterwards invert to get fig2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I want to create an array of pixel values to pass into the
say a php script executes a ruby script in the background each time, php
Say a website on my localhost takes about 3 seconds to do each request.
Say I have a binary tree which contains pointers at each node going to
Say I have a number of trait s that each add some behaviour to
Say I have a list of member, each of which is a custom object:
Say that I have many blogs, and each blog has_many posts. These are stored
Say I have an parent entity, each of which have a number of children.
Let's say I have a list item and in each list item is a
Say that I have an article with multiple pages. Each page has a short

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.