[Learn maths from the beginning] section 170th space geometry

Source: Internet
Author: User

plot summary:
[Machine Xiao Wei] in the [engineer Ah Wei] accompanied by the beginning of the completion of Dan's cultivation,
The goal of this time to cultivate is [space geometry].

Drama Start:

Star Calendar April 10, 2016 09:06:46, the Milky Way Galaxy Earles the Chinese Empire Jiangnan Line province.
[Engineer Ah Wei] is studying [space geometry] with [machine Xiao Wei].










These are all drawn out in this way:

<span style= "FONT-SIZE:18PX;" >//gets the coordinates of the point on the Ellipse function ellipse (A, b) {//a, B is the ellipse's long, short half axis var retarray = new Array (), var Thita = 0;//The circumference of the ellipse is divided into the number of segments, the greater the more accurate V Ar N = 32;var Deltathita = Math.pi*2/n;var x = y = 0;for (var i = 0; i < N; i++) {x = A*math.cos (thita); y = B*math.sin ( Thita); Retarray.push ([x, y]); Thita + = Deltathita;} return Retarray;} </span>

<span style= "FONT-SIZE:18PX;" >//outlines the side if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis2d (0, 0,;); var  Transform = new transform (), var a = 5*r, b = 3*r;var Topface = Ellipse (A, b); var bottomface = Transform.translate (Topface, 0, -100); var size = Topface.length;var Vertface = [];for (var i = 0; i < size; i++) {Vertface.push ([topface[i][0], top FACE[I][1], bottomface[i][0], bottomface[i][1]);} LineDraw (Vertface, ' Blue ', 1), Shape.strokedraw ([].concat (Bottomface), ' Pink '), Shape.filldraw ([].concat (Topface), ' Red ');}} The format of the function LineDraw (array, style, scale) {//array [[Line Segment Origin (x, y), segment End (y)], ...], each segment has four elements to determine style = style? Style: ' Bla CK '; scale = scale?  Scale:1;var NewArray = new Array (), var size = Array.length;var ItemSize = Array[0].length;var item = [];//zoom step for (Var i = 0; i < size; i++) {item = [];for (var j = 0; J < ItemSize, J + +) {if (j 2 = = 0) {//x coordinate Item.push (array[i][j] * scale);} else {//y coordinate item.push (-array[i][j] * scale);}}newarray.push (item);} document.write (Newarray.join (', '));p Lot.save (). Setstrokestyle (style); for (var i = 0; i < size; i++) { Plot.beginpath (). MoveTo (Newarray[i][0], newarray[i][1). LineTo (Newarray[i][2], newarray[i][3]). Closepath (). Stroke ();} Plot.restore ();} </span>


Changes in various shapes:

<span style= "FONT-SIZE:18PX;" >var a = 5*r, b = 3*r;var topface = Shape.paraquad (0, 0, 0, a, b, MATH.PI/3); var bottomface = Transform.translate (topFa CE, 0, -100);</span>

This is a parallelogram, and there are all kinds of other shapes that are not posted, roughly the same.


The following small Wei see if it is possible to fill the side color.








This interesting figure is obtained by:

<span style= "FONT-SIZE:18PX;"  >if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis2d (0, 0, N); var transform = new Transform (); var a = 5*r, b = 3*r;var topface = Shape.nstar (0, 0, a, 5); var bottomface = transform.translate (topface, 0,- 100)///Vertical side handling var size = Topface.length;var Vertface = [];for (var i = 1; i < size; i+=2) {Vertface.push ([topface[i][0] , Topface[i][1], bottomface[i][0], bottomface[i][1]]);} Facedraw (Vertface, ' Blue ', 1), Shape.strokedraw ([].concat (Bottomface), ' Pink '), Shape.filldraw ([].concat (Topface), ' Red ');} </span>

Of course, this side coloring tool is indispensable:

<span style= "FONT-SIZE:18PX;" >function Facedraw (array, style, scale) {//array format [[Start of Line (x, y), Segment end point (×, y)], ...], each segment has four elements to determine style = style? Style: ' black '; scale = scale?  Scale:1;var NewArray = new Array (), var size = Array.length;var ItemSize = Array[0].length;var item = [];//zoom step for (Var i = 0; i < size; i++) {item = [];for (var j = 0; J < ItemSize, J + +) {if (j 2 = = 0) {//x coordinate Item.push (array[i][j] * scale);} else {//y coordinate item.push (-array[i][j] * scale);}} Newarray.push (item);} document.write (Newarray.join (', '));p Lot.save (). Setfillstyle (Style). Setstrokestyle (' yellow '). Setlinewidth (4); var x1 = x2 = y1 = y2 = 0,x3 = x4 = Y3 = Y4 = 0;for (var i = 0; i < size; i++) {x1 = Newarray[i][0];y1 = newarray[i][1] ; x2 = Newarray[i][2];y2 = Newarray[i][3];if (i < size-1) {x3 = Newarray[i+1][0];y3 = newarray[i+1][1];x4 = Newarray[i +1][2];y4 = newarray[i+1][3];} else {x3 = Newarray[0][0];y3 = newarray[0][1];x4 = Newarray[0][2];y4 = Newarray[0][3];} Plot.beginpath (). MoveTo (x1, y1). lineTo (x2, y2). LineTo (x4, Y4). LineTo (x3, y3). Closepath (). Fill (); for (var i = 0; i < size; i++) {x1 = Newarray[i][0];y1 = newarray[i][1];x2 = Newarray[i][2];y2 = newarray[i][3];p lot.be Ginpath (). MoveTo (x1, y1). LineTo (x2, y2). Closepath (). stroke (); Plot.restore ();} </span>





If you do not use the intuitive drawing, the painting is not very three-dimensional:

<span style= "FONT-SIZE:18PX;"  >if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis2d (0, 0, N); var transform = new Transform (); var a = 5*r, b = 3*r;var topface = Shape.nedge (0, 0, B, 4); var bottomface = Transform.scale (Transform.transla Te (topface, 0,-100), 1.5, 1.2);//Vertical side handling var size = Topface.length;var Vertface = [];for (var i = 0; i < size; i++) {ve Rtface.push ([topface[i][0], topface[i][1], bottomface[i][0], bottomface[i][1]]);} Facedraw (Vertface, ' Blue ', 1), Shape.strokedraw ([].concat (Bottomface), ' Pink '), Shape.filldraw ([].concat (Topface), ' Red ');} </span>

Just like this:













Well, Xiao Wei should study this oblique two-way painting, otherwise you can not draw a good picture.



[People challenge teacher] so a lot of steps, Xiao Wei really did not understand, but, Xiao Wei has his own method, first look at the results:




It seems to be the same, isn't it, this is drawn out:

<span style= "FONT-SIZE:18PX;" >if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis3d (0, 0, 0,); var transform = New Transform (); var a = 5*r, b = 3*r;var topface = Shape.nedge (0, 0, B, 6); var size = Topface.length;var Array = [];for (v Ar i = 0; i < size; i++) {Array.push (Shape.point3d (Topface[i][0], 0, topface[i][1]));} Array = transform.flipy (array); Shape.angledraw ([].concat (array), ' Red ', 3);} </span>


Look at the ellipse again:


Wow, that's so cool, isn't that the legendary [inverse star]?


<span style= "FONT-SIZE:18PX;" >if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis3d (0, 0, 0,); var transform = New Transform (); var a = 5*r, b = 3*r;var Topface = Ellipse (A, b); var size = Topface.length;var Array = [];for (var i = 0; i < size; i++) {Array.push (Shape.point3d (Topface[i][0], 0, topface[i][1]));} Array = transform.flipy (array); Shape.angledraw ([].concat (array), ' Red ', 3);} </span>

In fact, this is the shape:





This box is too small, really not a mighty domineering.


< Span style= "FONT-SIZE:18PX;" >if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis3d (0, 0, 0,); var transform = New Transform (); var a = 4*r, B = 3*r, h = 2*r;var array = shape.paraquad (0, 0, 0, a, b, MATH.PI/2); var size = Array.Length var topface = [], bottomface = [];for (var i = 0; i < size; i++) {Topface.push (Shape.point3d (Array[i][0], 0, array[i][ 1])); Bottomface.push (Shape.point3d (array[i][0],-H, array[i][1]));} Topface = transform.flipy (topface); bottomface = transform.flipy (bottomface);//Vertical side handling var size = Topface.length;var Vertface = [];for (var i = 0; i < size; i++) {Vertface.push ([topface[i][0], topface[i][1], bottomface[i][0], bottomface I [1]]);} Facedraw (Vertface, ' Blue ', 1), Shape.strokedraw ([].concat (Bottomface), ' Pink '), Shape.filldraw ([].concat (Topface), ' Red ');} </span> 





<span style= "FONT-SIZE:18PX;" >if (1) {var r = 20;config.setsector (1,1,1,1); config.graphpaper2d (0, 0, R); config.axis3d (0, 0, 0,); var transform =  New Transform (); var a = 4*r, B = A, h = 2*r;var array = ellipse (A, a); var size = Array.length;var Topface = [], bottomface = [];for (var i = 0; i < size; i++) {Topface.push (Shape.point3d (Array[i][0], 0, array[i][1])); Bottomface.push (Shape.po Int3d (Array[i][0],-H, array[i][1]));} Topface = transform.flipy (topface); bottomface = transform.flipy (bottomface);//Vertical side handling var size = Topface.length;var Vertface = [];for (var i = 0; i < size; i++) {Vertface.push ([topface[i][0], topface[i][1], bottomface[i][0], bottomface I [1]]);} Facedraw (Vertface, ' Blue ', 1); vertface = [];for (var i = 0; i < size; i++) {Vertface.push ([topface[i][0], topface[i][1] , 0, 100]);} Shape.strokedraw ([].concat (Bottomface), ' Pink ', 1); Shape.filldraw ([].concat (Topface), ' Red ', 1); Facedraw (Vertface, ' Cyan ', 1);} </span>

This ellipse is always not very positive, why this, Xiao Wei don't understand. No other polygon has this problem.



<span style= "FONT-SIZE:18PX;" >var a = 4*r, B = A, h = 2*r;var edges = 5;var Array = Shape.nedge (0, 0, a, edges,-math.pi);</span>





Forget it, don't tune it out, let it go.













The end of this section, to know how to funeral, please see tell.



[Learn maths from the beginning] section 170th space geometry

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.