How to make perfect arc of a circle in HTML only using <path>? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 6

How to make perfect arc of a circle in HTML only using <path>?

I have something to make and its not here in SL. I was about to use C, A, Q, S but it didnt work anyway. Hpw do I make a perfect curve (or at leats an arc) in HTML without using <circle> but <path>? I tried making some but the results are like a parabolic shape. The center can be 50 50. The curve starts at the origon, 0 0. Then ends at 0 100.

1st Feb 2020, 4:38 AM
Name Omitted until I come back
2 Respostas
0
You should take a look at Bresenham's Circle Algorithm. It has been translated to most languages I know, and it's basically an algorithm to draw a circle using a pixel grid. With a bit of tweaking, I'm sure you can figure something out to only print one arc of it. Good Luck
1st Feb 2020, 5:37 AM
coddy
coddy - avatar
0
Or you can use math Radi=Pi/180 Function nx(oldx,angle,length) nx=oldx+(sign(angle)Ɨlength) Function ny(oldy,angle,length) my=moldy+(cos(angle)Ɨlength) Angle and Length either one cannot be 0 Ps you can also can make line by not changing. For example: use line or something simular. Line xp,yp xp1,yp1 Need forecolor More sample below Length can be from 1 to as big as want it. The larger the number is bigger the circle or arc Inialize your circle Or arc. First start your x y angle point Make loop or some data for the angle. If want dots or dots with different color for each angle. x=nx:y=ny Pixel(x,y) oldx=x:oldy=y Make a circle with line First initialize the xp1=nx xp1=ny angle Repeat the following until you get your ending angle Start: Line xp,yp xp1,yp1 Oldx=xp1:Oldy=yp1 Angle=Angle+1 Logic angle < entangle goto Start else Exit Exit
2nd Feb 2020, 6:28 PM
Conny Peterson
Conny Peterson - avatar