(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



(* Par Marcel D\[EAcute]l\[EGrave]ze  *)


BeginPackage["Tortue`"]


nouvelleLigne::usage="nouvelleLigne[position_List,direction] initialise une nouvelle ligne polygonale."


avance::usage="avance[distance] ajoute un nouveau segment de longueur distance."


tourne::usage="tourne[angle] modifie la direction courante."


ligne::usage="ligne[] retourne la liste des points."


arguments::usage="arguments[] retourne la liste des directions."


fermeLigne::usage="fermeLigne[] ferme le polygone."


bissectrIntG::usage="bissectrIntG[] retourne la liste des directions des bissectrices des angles int\[EAcute]rieurs du c\[OHat]t\[EAcute] gauche."


Begin["Private`"]


nouvelleLigne[pos_List,dir_]:=Module[{},
posCrt=pos;
ligneCrt={pos};
dirCrt=dir;
argCrt={dir};]


avance[d_]:=Module[{},posCrt=N[posCrt+d {Cos[dirCrt],Sin[dirCrt]}];AppendTo[ligneCrt,posCrt];posCrt]


tourne[\[Alpha]_]:=Module[{},dirCrt=N[dirCrt+\[Alpha]];
AppendTo[argCrt,dirCrt];dirCrt]


ligne[]:=ligneCrt


arguments[]:=argCrt


fermeLigne[]:=Module[{},tourne[Arg[(First[ligneCrt][[1]]-Last[ligneCrt][[1]])+\[ImaginaryI] (First[ligneCrt][[2]]-Last[ligneCrt][[2]])]-dirCrt+2 \[Pi]];AppendTo[ligneCrt,First[ligneCrt]];Last[ligneCrt]]


bissectrIntG[]:=Module[{aa,bi},aa=arguments[];bi=1/2 (aa+\[Pi]+RotateRight[aa]);bi[[1]]=bi[[1]]+\[Pi];bi]


End[]


EndPackage[]
