From: <jb...@us...> - 2008-12-31 05:52:57
|
Revision: 9235 http://plplot.svn.sourceforge.net/plplot/?rev=9235&view=rev Author: jbauck Date: 2008-12-31 05:52:54 +0000 (Wed, 31 Dec 2008) Log Message: ----------- Update Ada examples x15.adb and xthick15.adb. Modified Paths: -------------- trunk/examples/ada/x15a.adb.cmake trunk/examples/ada/xthick15a.adb.cmake Modified: trunk/examples/ada/x15a.adb.cmake =================================================================== --- trunk/examples/ada/x15a.adb.cmake 2008-12-30 03:11:03 UTC (rev 9234) +++ trunk/examples/ada/x15a.adb.cmake 2008-12-31 05:52:54 UTC (rev 9235) @@ -132,7 +132,30 @@ sh_cmap : Integer := 0; sh_width : Integer; min_color, min_width, max_color, max_width : Integer := 0; + + -- C run amok. The following arrays are made to accommodate the + -- original example which is written in perverse C. + inc_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); + inc_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := + ((450, -450), (0, 900), (0, 450), (450, -450), (0, 900)); + + del_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); + del_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := + ((2000, 2000), (2000, 2000), (2000, 2000), (4000, 4000), (4000, 2000)); begin + -- Initialize the rest of the amokified arrays. + inc_0_To_4(0)(0) := 450; + inc_0_To_4(1)(0) := -450; + inc_0_To_4(2)(0) := 0; + inc_0_To_4(3)(0) := 900; + inc_0_To_4(4)(0) := 300; + + del_0_To_4(0)(0) := 2000; + del_0_To_4(1)(0) := 2000; + del_0_To_4(2)(0) := 2000; + del_0_To_4(3)(0) := 2000; + del_0_To_4(4)(0) := 2000; + sh_width := 2; pladv(0); @@ -144,8 +167,11 @@ shade_min := zmin + (zmax - zmin) * Long_Float(i) / 10.0; shade_max := zmin + (zmax - zmin) * Long_Float(i +1) / 10.0; sh_color := Long_Float(i + 6); - plpsty((i + 2) mod 8 + 1); - + if i in 0 .. 4 then + plpat(inc_0_To_4(i), del_0_To_4(i)); + else + plpat(inc_5_To_9(i), del_5_To_9(i)); + end if; plshade1(z, Mask_Function_No_Mask'access, -1.0, 1.0, -1.0, 1.0, shade_min, shade_max, sh_cmap, sh_color, sh_width, @@ -159,6 +185,41 @@ pllab("distance", "altitude", "Bogon flux"); end plot2; + ---------------------------------------------------------------------------- + -- plot3 + -- Illustrates shaded regions in 3d, using a different fill pattern for + -- each region. + ---------------------------------------------------------------------------- + procedure plot3 is + xx : array (0 .. 1) of Real_Vector(0 ..4) := + ((-1.0, 1.0, 1.0, -1.0, -1.0), + (-1.0, 1.0, 1.0, -1.0, -1.0)); + yy : array (0 .. 1) of Real_Vector(0 ..4) := + ((1.0, 1.0, 0.0, 0.0, 1.0), + (-1.0, -1.0, 0.0, 0.0, -1.0)); + zz : array (0 .. 1) of Real_Vector(0 ..4) := + ((0.0, 0.0, 1.0, 1.0, 0.0), + (0.0, 0.0, 1.0, 1.0, 0.0)); + begin + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30.0, -40.0); + + -- Plot using identity transform + plcol0(1); + plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); + plcol0(2); + pllab("","","3-d polygon filling"); + plcol0(3); + plpsty(1); + plline3(xx(0), yy(0), zz(0)); + plfill3(xx(0)(0 .. 3), yy(0)(0 .. 3), zz(0)(0 .. 3)); + plpsty(2); + plline3(xx(1), yy(1), zz(1)); + plfill3(xx(1)(0 .. 3), yy(1)(0 .. 3), zz(1)(0 .. 3)); + end; + begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); @@ -183,6 +244,7 @@ plot1; plot2; + plot3; plend; end x15a; Modified: trunk/examples/ada/xthick15a.adb.cmake =================================================================== --- trunk/examples/ada/xthick15a.adb.cmake 2008-12-30 03:11:03 UTC (rev 9234) +++ trunk/examples/ada/xthick15a.adb.cmake 2008-12-31 05:52:54 UTC (rev 9235) @@ -132,7 +132,30 @@ sh_cmap : Integer := 0; sh_width : Integer; min_color, min_width, max_color, max_width : Integer := 0; + + -- C run amok. The following arrays are made to accommodate the + -- original example which is written in perverse C. + inc_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); + inc_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := + ((450, -450), (0, 900), (0, 450), (450, -450), (0, 900)); + + del_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); + del_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := + ((2000, 2000), (2000, 2000), (2000, 2000), (4000, 4000), (4000, 2000)); begin + -- Initialize the rest of the amokified arrays. + inc_0_To_4(0)(0) := 450; + inc_0_To_4(1)(0) := -450; + inc_0_To_4(2)(0) := 0; + inc_0_To_4(3)(0) := 900; + inc_0_To_4(4)(0) := 300; + + del_0_To_4(0)(0) := 2000; + del_0_To_4(1)(0) := 2000; + del_0_To_4(2)(0) := 2000; + del_0_To_4(3)(0) := 2000; + del_0_To_4(4)(0) := 2000; + sh_width := 2; Advance_To_Subpage(0); @@ -144,8 +167,11 @@ shade_min := zmin + (zmax - zmin) * Long_Float(i) / 10.0; shade_max := zmin + (zmax - zmin) * Long_Float(i +1) / 10.0; sh_color := Long_Float(i + 6); - Select_Fill_Pattern((i + 2) mod 8 + 1); - + if i in 0 .. 4 then + Set_Fill_Pattern(inc_0_To_4(i), del_0_To_4(i)); + else + Set_Fill_Pattern(inc_5_To_9(i), del_5_To_9(i)); + end if; Shade_Region_1(z, Mask_Function_No_Mask'access, -1.0, 1.0, -1.0, 1.0, shade_min, shade_max, sh_cmap, sh_color, sh_width, @@ -159,6 +185,41 @@ Write_Labels("distance", "altitude", "Bogon flux"); end plot2; + ---------------------------------------------------------------------------- + -- plot3 + -- Illustrates shaded regions in 3d, using a different fill pattern for + -- each region. + ---------------------------------------------------------------------------- + procedure plot3 is + xx : array (0 .. 1) of Real_Vector(0 ..4) := + ((-1.0, 1.0, 1.0, -1.0, -1.0), + (-1.0, 1.0, 1.0, -1.0, -1.0)); + yy : array (0 .. 1) of Real_Vector(0 ..4) := + ((1.0, 1.0, 0.0, 0.0, 1.0), + (-1.0, -1.0, 0.0, 0.0, -1.0)); + zz : array (0 .. 1) of Real_Vector(0 ..4) := + ((0.0, 0.0, 1.0, 1.0, 0.0), + (0.0, 0.0, 1.0, 1.0, 0.0)); + begin + Advance_To_Subpage(Next_Subpage); + Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); + Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); + Set_Up_3D(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30.0, -40.0); + + -- Plot using identity transform + Set_Pen_Color(Red); + Box_Around_Viewport_3D("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); + Set_Pen_Color(Yellow); + Write_Labels("","","3-d polygon filling"); + Set_Pen_Color(Green); + Select_Fill_Pattern(1); + Draw_Curve_3D(xx(0), yy(0), zz(0)); + Fill_Polygon_3D(xx(0)(0 .. 3), yy(0)(0 .. 3), zz(0)(0 .. 3)); + Select_Fill_Pattern(2); + Draw_Curve_3D(xx(1), yy(1), zz(1)); + Fill_Polygon_3D(xx(1)(0 .. 3), yy(1)(0 .. 3), zz(1)(0 .. 3)); + end; + begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); @@ -183,6 +244,7 @@ plot1; plot2; + plot3; End_PLplot; end xthick15a; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |