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 6118491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:26:33+00:00 2026-05-23T15:26:33+00:00

Generally we traverse the array by row or column but here I want to

  • 0

Generally we traverse the array by row or column but here I want to traverse it in an angle.
I will try and explain what I mean,
So lets say if the angle is 45 degree then rather than row by col it would search as (0,0) then (0,1) (1,0) then (0,2) , (1,1) ,(2,0) and so on.. .(sorry could not upload an image as I am new user and not allowed to do so, may be try and imagine/draw an array that would help get what I am trying to say)
But what will happen if the user inputs an angle like 20 degree how can we determine how to search the array.

i just wanted to know if there is any algorithm which does something similar to this? Programming language is not an issue i guess the issue is more of algoritham sort.
Any ideas would be welcome.
Please feel free to ask if I am not able to explain clearly what I am looking for.

Thanks guys.

  • 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-05-23T15:26:34+00:00Added an answer on May 23, 2026 at 3:26 pm

    Easy. Take an angle (let’s say 45). This corresponds to a vector v=(1, 1) in your case. (This can be normalized to a unitary vector (sqrt(2)/2, sqrt(2)/2), but this is not necessary)

    For every single point in your array, you have their coordinates (x, y). Simply do the scalar product of these coordinates with the vector. Let’s call f(x, y) = scalarProduct((x, y), v)

    Sort the values of f(x, y) and you’ve got the “traversing” you’re looking for!


    A real example.
    Your matrix is 3×3
    The scalar products are :

    (0,0).(1,1) = 0

    (0,1).(1,1) = 1

    (0,2).(1,1) = 2

    (1,0).(1,1) = 1

    (1,1).(1,1) = 2

    (1,2).(1,1) = 3

    (2,0).(1,1) = 2

    (2,1).(1,1) = 3

    (2,2).(1,1) = 4

    If you order these scalar products by ascending order, you obtain the ordering (0,0), (1,0), (1,0), (2,0), (1,1), (0,2), (2,1)…


    And if you want to do it with the angle 20, replace all occurences of v=(1, 1) with v=(cos(20), sin(20))


    Here’s an illustration of a geometrical interpretation. The scalar products correspond to the intersections of the vector v (in red) with the blue lines.

    Illustration

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

Sidebar

Related Questions

Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector , but this requires a
Generally when I use ClickOnce when I build a VB.NET program but it has
Generally, when using the conditional operator, here's the syntax: int x = 6; int
Generally,our fixes/patches for any bugs involves changes in multiple files and we will commit
Generally , how can you determine how to iterate through an array based on
Generally I seem to be able to fix IE problems nowadays.. but this one
Generally speaking, any ant task which accepts a <mapper> will also accept several tags
Generally I've no complaints about the speed of Visual Studio, but if I write
Generally speaking, I'm a decent programmer, (C++, Java, Ruby, Python) but I at the
Generally I use lxml for my HTML parsing needs, but that isn't available on

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.