In[]:=
VarignonTheorem3D::usage="By joining the midpoints of each side of a convex quadrilateral, the figure is a parallelogram of area equal to half of the original quadrilateral. The perimeter of the parallelogram is equal to the sum of diagonals of the original quadrilateral. This theorem will be extended to 3D. You will write the vertices counterclockwise and consecutively ​​ (Make sure the vertices are coplanar). Then you will evaluate the notebook. ​ References: Personal, based in the Varignon's Theorem";
In[]:=
VarignonTheorem[{x1_,y1_,z1_},{x2_,y2_,z2_},{x3_,y3_,z3_},{x4_,y4_,z4_}]:=​​Module{},P1={x1,y1,z1};P2={x2,y2,z2};P3={x3,y3,z3};P4={x4,y4,z4};Ang1=
180
π
ArcCos
(P4-P1).(P2-P1)
Norm[P4-P1]Norm[P2-P1]
;​​Ang2=
180
π
ArcCos
(P1-P2).(P3-P2)
Norm[{P1-P2}]Norm[P3-P2]
;​​Ang3=
180
π
ArcCos
(P4-P2).(P2-P3)
Norm[P4-P2]Norm[P2-P3]
;​​Ang4=
180
π
ArcCos
(P2-P4).(P1-P4)
Norm[P2-P4]Norm[P1-P4]
;​​Test=Det[{P2-P1,P3-P1,P4-P1}];​​IfAng1>180||Ang2>180||Ang3>180||Ang4>180||Test=!=0,Print[PasteButton["It's a concave quadrilateral or the vertices are not coplanar"]],​​
A
q
=
1
2
Norm[(P2-P1)(P4-P1)]+
1
2
Norm[(P2-P3)(P4-P3)];​​M1=
P1+P2
2
;M2=
P3+P2
2
;M3=
P3+P4
2
;​​M4=
P1+P4
2
;​​
A
p
=Norm[(M3-M4)(M1-M4)];​​
P
p
=Norm[M1-M4]+Norm[M2-M1]+Norm[M2-M3]+Norm[M3-M4];​​
P
p1
=Norm[P3-P1]+Norm[P4-P2];​​p=Grid[{{QuadrilateralArea,ParallelogramArea,ParallelogramPerimeter,DiagonalsSum,ParallelogramVector1,ParallelogramVector3,ParallelogramVector2,ParallelogramVector4},{
A
q
,
A
p
,
P
p
,
P
p1
,M4-M1,M3-M2,M2-M1,M3-M4}},FrameAll,ItemSize->15,ItemStyle->15];​​Print[p];​​Print[" "];​​Show[qua=Polygon[{P1,P2,P3,P4}];​​​​paral=Polygon[{M1,M2,M3,M4}];{Graphics3D[{EdgeForm[Thick],Yellow,Opacity[0.2],qua}],Graphics3D[{EdgeForm[Thick],Green,Opacity[0.8],paral}],Graphics3D[{Black,Ball[P1,0.1]}],Graphics3D[{Black,Ball[P2,0.1]}],Graphics3D[{Black,Ball[P3,0.1]}],Graphics3D[{Black,Ball[P4,0.1]}],Graphics3D[{LightGray,Ball[M1,0.1]}],Graphics3D[{LightGray,Ball[M2,0.1]}],Graphics3D[{LightGray,Ball[M3,0.1]}],Graphics3D[{LightGray,Ball[M4,0.1]}]},AxesLabel->{x,y,z},AxesOrigin{0,0,0},AxesTrue,BoxedFalse,BoxRatiosAutomatic,PlotRangeAll,ViewPoint{5,-2.4,1.},ImageSize700]​​​​​​
Example:
Four points are sought on the plane x - 2y = 5 . Los puntos son:
In[]:=
Showx1=4;x2=12;x3=16;x4=6;ContourPlot3D[x-2y==5,{x,-20,20},{y,-20,20},{z,-20,20}],Graphics3DBlack,Ballx1,
x1-5
2
,3,0.5,Graphics3DBlack,Ballx2,
x2-5
2
,7,0.5,Graphics3DBlack,Ballx3,
x3-5
2
,-5,0.5,Graphics3DBlack,Ballx4,
x4-5
2
,-1,0.5
Out[]=
In[]:=
VarignonTheorem4,-
1
2
,3,12,
7
2
,7,16,
11
2
,-5,6,
1
2
,-1
QuadrilateralArea
ParallelogramArea
ParallelogramPerimeter
DiagonalsSum
ParallelogramVector1
ParallelogramVector3
ParallelogramVector2
ParallelogramVector4
36
5
18
5
2
61
+
109
2
61
+
109
-3,-
3
2
,-4
-3,-
3
2
,-4
{6,3,-4}
{6,3,-4}
Out[]=