Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 506 characters in body
Source Link
nwellnhof
  • 10.6k
  • 1
  • 20
  • 38

Perl 6, 44 bytes

{!im ($^b-$^a)*($^d-$^c)/(($d-$a)*($b-$c)):}

Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

Port of Misha Lavrov's TI-Basic solution, 33 bytes

{![*](map */*,($_ Z-.rotate)).im}

Try it online!

Perl 6, 44 bytes

{!im ($^b-$^a)*($^d-$^c)/(($d-$a)*($b-$c)):}

Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

Perl 6, 44 bytes

{!im ($^b-$^a)*($^d-$^c)/(($d-$a)*($b-$c)):}

Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

Port of Misha Lavrov's TI-Basic solution, 33 bytes

{![*](map */*,($_ Z-.rotate)).im}

Try it online!

edited body
Source Link
nwellnhof
  • 10.6k
  • 1
  • 20
  • 38

Perl 6, 44 bytes

{!im ($^c$^b-$^a)*($^b-$^d-$^c)/(($b$d-$a)*($c$b-$d$c)):}

Try it online! Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

Perl 6, 44 bytes

{!im ($^c-$^a)*($^b-$^d)/(($b-$a)*($c-$d)):}

Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

Perl 6, 44 bytes

{!im ($^b-$^a)*($^d-$^c)/(($d-$a)*($b-$c)):}

Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

Source Link
nwellnhof
  • 10.6k
  • 1
  • 20
  • 38

Perl 6, 44 bytes

{!im ($^c-$^a)*($^b-$^d)/(($b-$a)*($c-$d)):}

Try it online!

Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.

AltStyle によって変換されたページ (->オリジナル) /