S
S
StasUssov2020-10-01 21:18:29
Programming
StasUssov, 2020-10-01 21:18:29

How to determine the position of a pixel on a rectangle?

Given a rectangle with sides w and h. There is also a time axis, where Start Time is the upper left corner and End Time is the lower right. Start Time = 12:00 and End Time = 4:00. The pixel is at 12:30. Determine the position of a pixel on a rectangle.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-10-02
@zagayevskiy

It is enough to calculate the ratio of the length of the diagonal to the segment from the corner to the pixel, and multiply w and h by this ratio. If 4:00 == 16:00, then the coordinates will be (0.125w, 0.125h).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question