Exploring Analyic Geometry with Mathematica®

Home Contents Commands Packages Explorations Reference
Tour Lines Circles Conics Analysis Tangents

D2DPencil2D

The package D2DPencil2D implements functions for computing families of Descarta2D curves (lines, circles and quadratics).

Initialization

BeginPackage["D2DPencil2D`",{"D2DCircle2D`", "D2DExpressions2D`", "D2DGeometry2D`", "D2DLine2D`", "D2DQuadratic2D`", "D2DPoint2D`"}];

D2DPencil2D::usage=
   "D2DPencil2D is a package that construction pencil curves.";

Pencil2D::usage=
   "Pencil2D is a keyword used to specify the formation of a pencil of objects.";

Begin["`Private`"];

Line Pencils

Pencil of Lines Through a Point

Format: Line2D[point,t,Pencil2D]
Constructs a line parameterized by the variable t representing the pencil of lines through a point.  The variable t is the angle of rotation of the line.

Line2D[Point2D[{x_,y_}],t_?IsScalar2D,Pencil2D] :=
   Line2D[-Sin[t],Cos[t],x*Sin[t]-y*Cos[t]];

Pencil of Lines Through Intersection Point

Format: Line2D[line,line,k,Pencil2D]
Constructs a line parameterized by the variable k representing the pencil of lines through the intersection of two lines.

Line2D[Line2D[a1_,b1_,c1_],Line2D[a2_,b2_,c2_],k_?IsScalar2D,Pencil2D] :=
   Line2D[(1-k)*a1+k*a2,(1-k)*b1+k*b2,(1-k)*c1+k*c2];

Circle Pencils

Pencil of Circles from Two Circles

Format: Circle2D[circle,circle,k,Pencil2D]
Constructs a circle parameterized by the variable k representing the pencil of circles having common intersection points with two given circles.

Circle2D[Circle2D[{h1_,k1_},r1_],Circle2D[{h2_,k2_},r2_],
         k_?IsScalar2D,Pencil2D] :=
   Module[{H,K,R1,R2,R},
      H=(1-k)*h1+k*h2;
      K=(1-k)*k1+k*k2;
      R1=h1^2+k1^2-r1^2;
      R2=h2^2+k2^2-r2^2;
      R=Sqrt[H^2+K^2-(1-k)*R1-k*R2];
      Circle2D[{H,K},R] ];

Quadratic Pencils

Pencil of Quadratics from Two Quadratics

Format: Quadratic2D[quad,quad,k,Pencil2D]
Constructs a quadratic parameterized by the variable k representing the pencil of quadratics through the intersection points of two given quadratics.

Quadratic2D[Quadratic2D[a1_,b1_,c1_,d1_,e1_,f1_],
            Quadratic2D[a2_,b2_,c2_,d2_,e2_,f2_],
            k_?IsScalar2D,Pencil2D] :=
   Quadratic2D[(1-k)*a1+k*a2,(1-k)*b1+k*b2,(1-k)*c1+k*c2,
               (1-k)*d1+k*d2,(1-k)*e1+k*e2,(1-k)*f1+k*f2];

Pencil of Quadratics from Four Lines

Format: Quadratic2D[{line,line},{line,line},k,Pencil2D]
Constructs a quadratic parameterized by the variable k representing the pencil of quadratics passing through the four intersection points of four lines taken in predetermined pairs (1-2 with 3-4, and 1-3 with 2-4).

Quadratic2D[{L1:Line2D[a1_,b1_,c1_],L2:Line2D[a2_,b2_,c2_]},
            {L3:Line2D[a3_,b3_,c3_],L4:Line2D[a4_,b4_,c4_]},
            k_?IsScalar2D,Pencil2D] :=
   Module[{Q1,Q2},
      Q1=Quadratic2D[L1,L2];
      Q2=Quadratic2D[L3,L4];
      Quadratic2D[Q1,Q2,k,Pencil2D] ];

Pencil of Quadratics from Four Points

Format: Quadratic2D[point,point,point,point,k,Pencil2D]
Constructs a quadratic parameterized by the variable k representing the pencil of quadratics passing through four points.

Quadratic2D::coincident=
   "Two or more of the points are coincident; no valid quadratic pencil exists.";

Quadratic2D[P1:Point2D[{x1_,y1_}],P2:Point2D[{x2_,y2_}],
            P3:Point2D[{x3_,y3_}],P4:Point2D[{x4_,y4_}],
            k_?IsScalar2D,Pencil2D] :=
   If[IsCoincident2D[{P1,P2,P3,P4}],
      Message[Quadratic2D::coincident];$Failed,
      Quadratic2D[{Line2D[P1,P2],Line2D[P3,P4]},
                  {Line2D[P1,P3],Line2D[P2,P4]},k,Pencil2D] ];

Epilogue

End[ ]; (* end of "`Private" *)
EndPackage[ ]; (* end of "D2DPencil2D`" *)


Copyright © 1999-2007 Donald L. Vossler, Descarta2D Publishing
www.Descarta2D.com