Exploring Analyic Geometry with Mathematica®

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

D2DArea2D

The package D2DArea2D computes areas associated with Descarta2D objects.

Initialization

BeginPackage["D2DArea2D`", {"D2DArc2D`", "D2DCircle2D`", "D2DConicArc2D`", "D2DEllipse2D`", "D2DExpressions2D`", "D2DGeometry2D`", "D2DHyperbola2D`", "D2DLine2D`", "D2DNumbers2D`", "D2DParabola2D`", "D2DPoint2D`", "D2DTriangle2D`"}];

D2DArea2D::usage=
   "D2DArea2D is a package for computing areas.";

Area2D::usage=
   "Area2D[object] computes the area of a closed object";

SectorArea2D::usage=
   "SectorArea2D[object,{t1,t2}] computes the area of a sector of an object.";

SegmentArea2D::usage=
   "SegmentArea2D[object,{t1,t2}] computes the area of a segment of an object.";

Begin["`Private`"];

Areas Associated with an Arc

Area

Format: Area2D[arc]
Computes the area between an arc and its chord.

Area2D[A:Arc2D[{x0_,y0_},{x1_,y1_},B_]] :=
   SegmentArea2D[Circle2D[A],PrimaryAngleRange2D[A]];

Areas Associated with a Circle

Area

Format: Area2D[circle]
Computes the area of a circle.

Area2D[Circle2D[{h_,k_},r_]] := Pi*r^2;

Sector Area

Format: SectorArea2D[circle,{"D2DArea2D_1.gif","D2DArea2D_2.gif"}]
Computes the area of a circle sector defined by two parameters.

SectorArea2D[Circle2D[{h_,k_},r_],{t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{T1,T2},
      {T1,T2}=PrimaryAngleRange2D[{t1,t2}];
      (T2-T1)*r^2/2 ];

Segment Area

Format: SegmentArea2D[circle,{"D2DArea2D_3.gif","D2DArea2D_4.gif"}]
Computes the area of a circle segment defined by two parameters.

SegmentArea2D[Circle2D[{h_,k_},r_],{t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{T1,T2,theta},
      {T1,T2}=PrimaryAngleRange2D[{t1,t2}];
      theta=T2-T1;
      r^2*(theta-Sin[theta])/2 ];

Areas Associated with a Conic Arc

Area

Format: Area2D[cnarc]
Computes the area between a conic arc and its chord for a conic arc in a standard position. The first case is for parabolas; the second case is for ellipses and hyperbolas.

Area2D[ConicArc2D[{0,0},{a_,b_},{d_,0},p_]] :=
   Module[{A},
      A=d*b/3;
      If[IsNegative2D[A],-A,A] ] /;
IsZero2D[p-1/2];

Area2D[ConicArc2D[{0,0},{a1_,b1_},{d1_,0},p_]] :=
   Module[{b,d,r},
      b*d*p*(p*r+(-1+p)^2*Log[(1-p)/(p+r)])/(2*r^3) //.
         {r->Sqrt[-1+2p],b->Sqrt[b1^2],d->Sqrt[d1^2]}] /;
Not[IsZero2D[p-1/2]];

Format: Area2D[cnarc]
Computes the area between a conic arc and its chord.  Notice that the x-coordinate of the apex point in standard position has no bearing on the area, and, therefore, is not computed.

Area2D[ConicArc2D[p0:{x0_,y0_},pA:{xA_,yA_},p1:{x1_,y1_},p_]] :=
   Module[{a,b,d},
      b=Distance2D[Point2D[pA],Line2D[p0,p1]];
      d=Distance2D[p0,p1];
      Area2D[ConicArc2D[{0,0},{a,b},{d,0},p]] ];

Areas Associated with an Ellipse

Area

Format:  Area2D[ellipse]
Computes the area of a complete ellipse.

Area2D[Ellipse2D[{h_,k_},a_,b_,alpha_]] := Pi*a*b;

Sector Area

Format: SectorArea2D[ellipse,{0,t}]
Computes the area of an ellipse sector between parameter values 0 and t.

SectorArea2D[E1:Ellipse2D[{h_,k_},a_,b_,alpha_],{0,t_?IsScalar2D}] :=
   Module[{T=PrimaryAngle2D[t]},
      Which[
         IsZero2D[T],        Pi*a*b,
         IsNegative2D[Pi-T], Pi*a*b/2+SectorArea2D[E1,{0,T-Pi}],
         True,               a*b*(Pi-2*ArcSin[Cos[t]])/4] ];

Format: SectorArea2D[ellipse,{"D2DArea2D_5.gif","D2DArea2D_6.gif"}]
Computes the area of an ellipse sector between two parameter values.

SectorArea2D[E1:Ellipse2D[{h_,k_},a_,b_,alpha_],
             {t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{T1,T2},
      {T1,T2}=PrimaryAngleRange2D[{t1,t2}];
      Which[
         IsZero2D[2Pi-(T2-T1)],
            Area2D[E1],
         IsNegative2D[2Pi-T2],
            Pi*a*b-SectorArea2D[E1,{T2-2Pi,T1}],
         True,
            SectorArea2D[E1,{0,T2}]-SectorArea2D[E1,{0,T1}]] ];

Segment Area

Format: SegmentArea2D[ellipse,{"D2DArea2D_7.gif","D2DArea2D_8.gif"}]
Computes the area of an ellipse segment between two paramter values.

SegmentArea2D[E1:Ellipse2D[{h_,k_},a_,b_,alpha_],
              {t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{T1,T2},
      {T1,T2}=PrimaryAngleRange2D[{t1,t2}];
      SectorArea2D[E1,{T1,T2}]-a*b*Sin[T2-T1]/2 ];

Areas Associated with a Hyperbola

Sector Area

Format: SectorArea2D[hyperbola,{"D2DArea2D_9.gif","D2DArea2D_10.gif"}]
Computes the area of a hyperbola sector between two parameter values.

SectorArea2D[Hyperbola2D[{h_,k_},a_,b_,t_],
             {t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{e,s,A},
      e=Sqrt[a^2+b^2]/a;
      s=ArcCosh[e];
      A=a*b*s*(t2-t1)/2;
      If[IsNegative2D[A],-A,A] ];

Segment Area

Format: SegmentArea2D[hyperbola,{"D2DArea2D_11.gif","D2DArea2D_12.gif"}]
Computes the area of a hyperbola segment between two parameters.

SegmentArea2D[Hyperbola2D[{h_,k_},a_,b_,t_],
              {t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{e,s,T,A},
      e=Sqrt[a^2+b^2]/a;
      s=ArcCosh[e];
      T=s*(t2-t1);
      A=a*b*(Sinh[T]-T)/2;
      If[IsNegative2D[A],-A,A]  ];

Areas Associated with a Parabola

Segment Area

Format: SegmentArea2D[parabola,{"D2DArea2D_13.gif","D2DArea2D_14.gif"}]
Computes the area of a segment of  parabola between two parameters.

SegmentArea2D[Parabola2D[{h_,k_},f_,theta_],
              {t1_?IsScalar2D,t2_?IsScalar2D}] :=
   Module[{A},
      A=f^2*(t2-t1)^3/3;
      If[IsNegative2D[A],-A,A] ];

Areas Associated with a Triangle

Area

Format: Area2D[triangle]
Computes the area of a triangle.

Area2D[Triangle2D[{x1_,y1_},{x2_,y2_},{x3_,y3_}]] :=
   Module[{A},
      A=Det[{{x1,y1,1},{x2,y2,1},{x3,y3,1}}]/2;
      If[IsNegative2D[A],-A,A] ];

Epilogue

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


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