Can anyone pls tell me what exactly those points do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone pls tell me what exactly those points do?

<svg width="2000" height="2000"><polygon points="100 100, 200 200, 300 0" style="fill: green; stroke:black;" /></svg>

4th Aug 2016, 8:20 PM
moli42
moli42 - avatar
5 Answers
+ 2
The values (Or numbers) show the coordonates of each point (Also the points are measured in pixels).So , for example let's take the numbers 100 100 and 300 0.The first one (100 100) tells the program where the point is positioned , so the first 100 means that the program will go 100 pixels away from the top-left of the screen in the direction right (So that told the program to move 100 pixels to the right , that's called the x-axis and if it was -100 it would've moved in the opposite direction , that beign left , experiment alittle around that).And now the other 100 tells the program to move downwards 100 pixels starting from the top-left of the screen (And if it was -100 it would've told to move upwards 100 pixels).And now , don't think that this will draw some-kind of line , the 100 100 just told the program to set the point to those coordonates , so , to make a line I took 300 0 . Now remember what I said and you should understand where the point 300 0 will go (This will set a point 300 pixels away to the right (From the top-left of the screen) and no pixels downward because the second number is 0).Now , that (In theory and most probablly)drew a line pointing (Aproximatively)to the top right of the screen . And that's what this numbers do : just tell the program where to set the points and then draws a line to unite them . And another good thing to now is that you need to place a " , " between each pair of coordinates (That means that in order for you to set two or more coordinates you NEED to place " , " in order to declare more pairs of coordinates . Example : 100 100 , 300 0 )Also this was what I got out from experimenting with the coordinates so if you're still confused , sorry I couldn't explain better ...
17th Nov 2016, 9:06 PM
Nimbrox
+ 1
you are not alone... struggling with the same thing. tried playing around with it but still no clue what is what. everything i think i know it i find out i dont xD you found out yet or?
13th Sep 2016, 5:01 PM
Emma Hjortsberg
Emma Hjortsberg - avatar
+ 1
Those are coordinates where to put edges of polygon. It goes like points = "x1, y1,x2,y2..."
13th Nov 2016, 4:21 PM
Hanc Hegel
Hanc Hegel - avatar
0
I'm confused :///
4th Aug 2016, 9:26 PM
moli42
moli42 - avatar
0
it draws a green triangle
11th Aug 2016, 12:48 AM
Bekir Uzun
Bekir Uzun - avatar