Perl で gdsii
実行環境
  Active Perl
     更新するには
ppm
  ppm
  DownLoad
  実行
Help
   perldoc GDS2
Examples
  basic-lines
  simple
  simple-sref
  aref
  circle
  circle-inverted
  sample-arc
  donut
  Inverted-Donuts
  Donuts_Combination
  Hello-World
  CP-array
  text2gds.pm
  rotate.pm
  rotate-rectangle
  arc.pm
  line-and-space-180
  triangle-array-nega
  sq_sleeve.pm
  TriangleGridStep
  triangle-array-nega-CP
  CirclesArray-SQ
  LargeCircles
  MA6-Alignment-mark.pm
  Alignment-Place
  Triangle-Grid
  Triangle-Grid-Wide
  ellipsis-polygons
  inscribe_polygon
  inscribe_polygon.pm
  inscribe_polygon-ellipsis.pm
  sleeving-by-square-sample
  sleeving-by-square.pm

Perl Perl/GDSII page
Download (as "arc.pm")

arc.pm

# -*- code: utf-8 -*-
package arc;
my($VERSION);
$VERSION = "2018-09-07 11:40" ; # written by emacs time-stamp

use POSIX qw(floor ceil);

sub arc($$$$ $$$$){
    my ($x)		= shift; # center coordinate x
    my ($y)		= shift; # center coordinate y
    my ($start_angle)	= shift; # in degree
    my ($end_angle)	= shift; # in degree

    my ($radius)	= shift; # in micron
    my ($polygon_count)	= shift; # default 12;
    my ($ROUND)		= shift; # round to this unit ( making not smooth line);
    my ($direction)	= shift; # -1  counter clockwise, 1 clockwise

    if ($polygon_count eq '') { $polygon_count = 12;}

    my (@PTR);
    if ($end_angle < $start_angle  && $direction > 0) { $end_angle += 360;}
    if ($end_angle == 0 && $start_angle == 0 ) { $start_angle = 0; $end_angle = 360;}

    my ($step)		= 
    ($end_angle - $start_angle)/$polygon_count;
    my ($count)		= ceil((abs($end_angle - $start_angle))/$step);
    my ($prevX, $prevY);
    foreach my $i (0 .. $count ){
	my $radian = ($start_angle + $i * $step) * 3.1415926535/180;
	my ($X) = $x + $radius * cos($radian);
	my ($Y) = $y + $radius * sin($radian);
	push(@PTR, [ $X, $Y]);
    }
    if ($direction < 0 ){ @PTR = reverse @PTR ;}
    my @COORDS;
    foreach my $i (0 .. $count){    
	push(@COORDS, ($PTR[$i]->[0],
	               $PTR[$i]->[1] ) );
    }
#    print join ("\n", @COORDS). "\n";
    return @COORDS
}
1;
Last Update: Mon, 21 Feb 2022 10:13:01 GMT 1.66 2008/03/08