[Learn maths from the beginning] the 191th section space vector and cubic geometry

Source: Internet
Author: User
Tags pow

plot summary:
[Machine Xiao Wei] in the [engineer Ah Wei] accompanied by the [nine turn elixir] of the five-turn of the cultivation.
This time we are going to look at [space vector and cubic geometry].

Drama Start:

Star Calendar April 23, 2016 11:00:22, the Milky Way Galaxy Earles the Chinese Empire Jiangnan Line province.
[Engineer Ah Wei] is working with [machine Xiao Wei] to study [space vector and solid geometry].

















<span style= "FONT-SIZE:18PX;" > #例5def dot (A, b):    if (Len (a) >= 3):        return a[0]*b[0] +a[1]*b[1]+a[2]*b[2];    Elif (Len (a) >= 2):        return a[0]*b[0] +a[1]*b[1];    else:        return a*b; #向量的绝对值def RAbs (a):    if (Len (a) >= 3):        return math.sqrt (a[0]**2 +a[1]**2 + a[2]**2);    Elif (Len (a) >= 2):        return math.sqrt (a[0]**2 +a[1]**2);    else:        return a;def angle (A, B):    return Math.acos (dot (b)/(RAbs (a) *rabs (b))) *180/math.pi;    def tmp ():    a = [0,-0.25,1];    b = [0, 0.25, 1];    Print (angle (a, b));</span>

<span style= "FONT-SIZE:18PX;" > #例6 >>> 90.0def tmp ():    a = [ -0.5, -0.5, 0.5];    b = [1, 0, 1];    Print (angle (a, b));</span>









<span style= "FONT-SIZE:18PX;"                  >//plane Vector if (1) {var r = 20;                    Config.setsector (1,1,1,1);                  Config.graphpaper2d (0, 0, R);                                  Config.axis2d (0, 0,190);                Axis set var ScaleX = 2*r, ScaleY = 2*r;                 var SpaceX = 2, SpaceY = 2;                var XS = -10, XE = 10;                var YS = -10, YE = 10;                  Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X ');                                             Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y ');              var array = [[1, 2], [4, 5], [7,2], [-8,-5], [-5, 3], [-8, 3], [8, 5], [-2, + 5], [2, 1], [7, 3];                          var size = Array.Length;            var transform = new transform ();                        var tmp = [];                          Array = Transform.scale (transform.translate (array, 0, 0), Scalex/spacex, Scaley/spacey);          TMP = [].concat (array); Vectordraw (TMP, ' red ');                  TMP = [].concat (array);                   Shape.pointdraw (tmp, ' Orange ', 1, 1);          Plot.setfillstyle (' Blue ');              Plot.filltext (' Vector graph ',-270,-170, 300); }</span>




<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,190);                Axis set var ScaleX = 4*r, ScaleY = 4*r;                 var SpaceX = 2, SpaceY = 2;                var XS = -10, XE = 10;                var YS = -10, YE = 10;                  Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X ');                                             Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y '); var array = [];for (var x = 2; x <= 2; x+=4) {for (var y =-2, y <= 2; y+=4) {for (var z =-2; z<=2; z+=4) {Arra    Y.push ([x, Y, z]);}}}        Array = shape.xyzsort (array);  var size = Array.Length;                        var array2d = [];for (var i = 0; i < size; i++) {Array2d.push (Shape.point3d (array[i][0], array[i][1], array[i][2]));}            var transform = new transform ();                    var tmp = [];    Array2D = Transform.scale (transform.translate (array2d, 0, 0), Scalex/spacex, Scaley/spacey);          TMP = [].concat (array2d);                    Vectordraw (TMP, ' red ');                  TMP = [].concat (array2d);                   Shape.pointdraw (tmp, ' Orange ', 1, 1);          Plot.setfillstyle (' Blue ');              Plot.filltext (' Vector graph ',-270,-170, 300); }</span>









<span style= "FONT-SIZE:18PX;" >//the distance of any two points in the lattice sequence set function Distancesort (Pointarray) {///incoming lattice column pointarray//format is [[Px1, Py1], [Px2, Py2], ...] document.write (Pointarray.join (', ') + ' <br/> ');//For each point in the Pointarray, the distance from all other points//results are put into distancearray//format for [[  Point 1 ordinal, point 2 ordinal, distance value]]var Distancearray = [number of];//points var size = pointarray.length;//Temp variable var distance = x1 = Y1 = Z1 = x2 = y2 = z2 = 0;var Dimension = pointarray[0].length;//calculated and pressed into the distance for (var i = 0; i < size; i++) {for (var j = i+1; j < size; J + +)  {x1 = pointarray[i][0];y1 = pointarray[i][1];x2 = Pointarray[j][0];y2 = Pointarray[j][1];if (Dimension > 2) {//three-dimensional point processing z1 = POINTARRAY[I][2];Z2 = pointarray[j][2];d istance = math.sqrt (Math.pow (x1-x2, 2) +math.pow (Y1-y2, 2) +Math.pow (Z1-Z2, 2) );} else {distance = Math.sqrt (Math.pow (x1-x2, 2) +math.pow (Y1-y2, 2));} Note that I < j//are guaranteed so that the starting point sequence number must be less than the end sequence number//This is to connect the start and end points of the line does not repeat Distancearray.push ([I, J, distance]);}} Sort//Sort weights for distance array: Starting point ordinal > Distance > End ordinal distancearray.sort (function (A, b) {if (a[0] = b[0]) {if (MAth.abs (A[2]-b[2]) < 0.000001) {return a[1]-b[1];} else {return a[2]-b[2];}} else {return a[0]-b[0];}}); /document.write (Distancearray.join (', ') + ' <br/> '); return distancearray;}                  if (1) {var r = 20;                    Config.setsector (1,1,1,1);                  Config.graphpaper2d (0, 0, R);                                  Config.axis2d (0, 0,190);                Axis set var ScaleX = 4*r, ScaleY = 4*r;                 var SpaceX = 2, SpaceY = 2;                var XS = -10, XE = 10;                var YS = -10, YE = 10;                  Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X ');                                             Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y '); var array = [];for (var x = 2; x <= 2; x+=4) {for (var y =-2, y <= 2; y+=4) {for (var z =-2; z<=2; z+=4) {Arra    Y.push ([x, Y, z]);}}}        Array = shape.xyzsort (array);  var size = Array.Length; var array2d = [];for (var i = 0; i < size; i++) {Array2d.push (sHape.point3d (Array[i][0], array[i][1], array[i][2]));}          Remove duplicate point var Pointarray = Removeduplicatedpoint (array2d);                    Number of non-repeating points var points = pointarray.length;          Get the distance array//format as [[Point 1 ordinal, point 2 ordinal, distance value], ...]          var Distancearray = Distancesort (Pointarray);                    The number of sides var edges = distancearray.length;          Store the side var linkedarray = [] that need to be connected;                    Number of connected edges var links = 0;                    The set of edges associated with each vertex var edgeofvertex = []; for (var i = 0; i < points; i++) {//Gets a collection of vertex-related edges Edgeofvertex = [              ];                      for (var j = 0; J < edges; J + +) {if (distancearray[j][0] = = I | |                  DISTANCEARRAY[J][1] = = i) {Edgeofvertex.push (distancearray[j]); }}//Based on the starting point, look for the shortest length of two sides edgeofvertex.sort (fuNction (A, b) {return a[2]-b[2];                            });              var choice = 2;              if (Edgeofvertex.length > Choice) {edgeofvertex = Edgeofvertex.slice (0, choice);          } Linkedarray = Linkedarray.concat (Edgeofvertex);          }//document.write (Linkedarray.join (', ') + ' <br/> ');          Linkedarray = Removeduplicatedpoint (Linkedarray);                    Links = linkedarray.length;                        document.write (Linkedarray.join (', ') + ' <br/> ');          var startPoint, EndPoint, x1, y1, x2, y2;                    Scaled var scale = 40;              for (var i = 0; i < links; i++) {startPoint = linkedarray[i][0];              EndPoint = linkedarray[i][1];              x1 = pointarray[startpoint][0];              y1 = pointarray[startpoint][1];              x2 = pointarray[endpoint][0]; y2 = Pointarray[enDPOINT][1];          Shape.vectordraw ([[X1,y1], [X2, Y2]], ' red ', scale);        } shape.pointdraw (Pointarray, ' blue ', scale, 1);        /*//array2d = Shape.angularsort (array2d);            var transform = new transform ();                        var tmp = [];                          Array2D = Transform.scale (transform.translate (array2d, 0, 0), Scalex/spacex, Scaley/spacey);          TMP = [].concat (array2d);                    Vectordraw (TMP, ' red ');                  TMP = [].concat (array2d);       Shape.pointdraw (tmp, ' Orange ', 1, 1);          */Plot.setfillstyle (' Blue ');              Plot.filltext (' Vector graph ',-270,-170, 300); }</span>


<span style= "FONT-SIZE:18PX;" >array = [[0,0,0],  [0, 0, 5], [5,0,5], [0, 5, 0], [0, 5, 5]];</span>



<span style= "FONT-SIZE:18PX;" >array = [[0,0,0],  [0, 0, 5], [5,0,0], [0, 5, 0]];</span>


<span style= "FONT-SIZE:18PX;" >array = [[0,0,0],  [0, 0, 5], [5,0,0], [0, 5, 0], [2, 2, 2], [2, 0, 2]];</span>


<span style= "FONT-SIZE:18PX;" >array = [[0,0,0],  [0, 0, 5], [5,0,0], [0, 5, 0], [2, 2, 2], [2, 0, 2], [ -7,3, -7]];</span>

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



[Learn maths from the beginning] the 191th section space vector and cubic 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.