Rand Stats

Math::Polygons

zef:p6steve

raku-Math-Polygons

Some polygon objects that draw via SVG - an alpha with the potential to do inheritance of Parallelograms, Rhomboids, etc.

Build Status

Instructions

There are three ways to consume this module:

  1. Jupyter Notebook local
  1. Jupyter Notebook hosted on Binder
  1. Perl6 Module

Synopsis

use SVG::Drawing;
use Math::Polygons;

my $rectangle = Rectangle.new( 
    origin => Point.new(20, 20),
    width  => 120, 
    height => 80  
);

my $square = Square.new( 
    origin => Point.new(170, 20),
    side   => 100 
);

my \A = Point.new( 20, 260);
my \B = Point.new( 30, 200);
my \C = Point.new(120, 145);
my \D = Point.new(125, 250);
my $quadrilateral = Quadrilateral.new(
    A, B, C, D,  
);

my $triangle = Triangle.new(
    fill => "green",
    stroke => "black",
    apex => Point.new(220, 160),
    side => 100 
);

my $drawing = SVG::Drawing.new( 
    elements => [ 
        $rectangle, 
        $square,
        $quadrilateral,
        $triangle,
    ],
);
$drawing.serialize.say;

Inspired by