A
A
Arman2016-06-20 12:13:23
PHP
Arman, 2016-06-20 12:13:23

How to convert degrees to coordinates?

DD.
Something completely forgotten the school curriculum. Maybe a stupid question, but it already blew the whole brain.
there is 180°:
db6f1253750144a098649d0ccf1e2a28.jpg
there are N-elements, it is necessary to distribute them evenly.
example:

1 элемент - 0°
2 элемента: 
- 0°
- 180°
3 эл-та:
- 0°
- 90°
- 180°
4 эл-та:
- 0°
- 60°
- 120°
- 180°
и т.д.

Elements are counted from the central point, it turns out
0° – x: -80; y: 0
90° – x: 0; y: -80
180° – x: 80; y: 0

80(?) - this is how far the element should be from the center
thanks

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Stalker_RED, 2015-11-12
@Stalker_RED

1. Compare the image binary
2. View the source of the letter, whether everything is present there.
For example, you have no handling of an unsuccessful move_uploaded_file() here at all
And the $boundary variable is not defined
. And yet, you have a vulnerability - $filename is not escaped or checked in any way.

S
smoln, 2015-11-12
@smoln

the variable is defined, I just didn't insert it into this piece

$boundary = "--".md5(uniqid(time())); 
 move_uploaded_file() никаких ошибок не выдает, насчет бинар. буду проверять

R
Rsa97, 2015-11-12
@Rsa97

Judging by the code, you have extra line breaks inside the email headers.
The email code should look like this:

... Здесь основная часть заголовка...
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=abcdef
Content-Transfer-Encoding: 7bit

This is a message in multipart MIME format.
--abcdef
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Привет!
--abcdef
Content-Type: application/xlsx; name=hello.xlsx
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=hello.xlsx

/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJ
...
/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJ
--abcdef--

Please note that the header block starts with --boundary, does not contain empty lines inside, ends with the first empty line, after which there is data until the next --boundary.

A
Alexey, 2016-06-20
@Arik

To distribute N elements in the range 0...180, you need to divide 180 by (N-1) and place points after each obtained degrees.
That is, Kx = X * 180 / (N-1), where Kx is the next point, X = 0.. N-1
If the points are numbered as X = 1...N, then Kx = (X-1) * 180 / (N-1)

V
vaut, 2016-06-20
@vaut

Search Google for the translation of coordinates from the polar system to the Cartesian.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question