New answers tagged trigonometry
2
votes
Finding Chord Segments with Integer Length
Charcoal, 75 bytes
≔⊕NθFθFιF⌕AX…¹θ²ΣX⊕⟦κι⟧²⊞υ⊕⟦κιλ⟧FυFυ¿∧⁼⌈ι⌈κ‹ικF…ι²Eօ겋⁺λμθ⭆¹⟦↔⁻λμ⁺λμ⌈ι
Try it online! Link is to verbose version of code. Explanation: ...
3
votes
Finding Chord Segments with Integer Length
Ruby, 126 bytes
->s{(t=*1..s).product(t,t).map{|i|r,x,y=i
x==y||!(x*x+y*y<q=r*r)||(q-x*x)**0.5%1+(n=x+j=(q-y*y)**0.5)%1>0||n>s||p([j-x,n,r])}}
Try it ...
4
votes
4
votes
Finding Chord Segments with Integer Length
JavaScript (V8), 121 bytes
A naive solution that prints the triplets m n r.
...
0
votes
A single pixel moving in a circular path
Setanta, 166 165 bytes
Setanta has a function to sleep for a certain interval but no function to get the current time, so the time required for one revolution might be slightly greater than 60 seconds....
2
votes
A single pixel moving in a circular path
assembly, 75 bytes
As DOS is already running in the graphics video mode 19, no video setup was needed.
Since this program is destined to run indefinitely, I have simply set the BIOS timer to zero so ...
0
votes
A single pixel moving in a circular path
TIC-80 Lua, 82 bytes
i=0 function TIC()cls(12)pix(120+60*math.cos(i),68+60*math.sin(i),1)i=i+.00173 end
0
votes
A single pixel moving in a circular path
Uiua, 50 bytes
Full program, outputs a 100x100 pixel GIF with 1 fps, circle starting at 3 o'clock and walking clockwise around in one minute.
...
1
vote
A single pixel moving in a circular path
Scratch, 145 122 bytes
Try it here
Should work in any framerate, though it won't update as smoothly. Now works only on 30 FPS (the default) so don't activate Turbo Mode. The circle is of radius 180 ...
Top 50 recent answers are included
Related Tags
trigonometry × 37code-golf × 34
math × 23
geometry × 12
graphical-output × 5
kolmogorov-complexity × 3
number × 2
integer × 2
fastest-code × 2
animation × 2
calculus × 2
approximation × 2
ascii-art × 1
code-challenge × 1
decision-problem × 1
matrix × 1
path-finding × 1
linear-algebra × 1
complex-numbers × 1
function × 1