Quote:
Coordinates to grid box number
This is not a programming problem, it is a mathematics problem.
You need to figure out the solution, and you don't need a computer for this, even if it can help.
All you need is a sheet of paper, a pencil and your head.
- You know the size of field and number of rows ans cols.
- It is not a big deal to deduce position of each row and of each column.
- Deducing row number and column number from coordinates is not complicated from there.
- Then convert to box number is not complicated either.
The whole problem is not really complicated if approached with method.
As you didn't stated a problem and didn't showed your work, I hope you only wanted general advice, I let you solve the problem as practicing.
[Update]
Quote:
This is not giving correct results
Just look at what you did, your
x
is outside of range.
X=8663
Y=3224
#Total No. columns
C=20
columnXY= (X/7450)
rowXY= (Y/11400)
and the formulas are wrong,
you should have another look at solution 2.
Your problem is an instance of:
You know that 7450 apples cost 20, you want only 3224 apples.
How much will it cost?
This is among the most simple problem you will have to solve in programming computer.
If you can't solve this by yourself, you are in deep sh*t and should think of another job.