javascript - How to fix errant orientation and points in an elliptical particle cloud? -


I am making the oval cloud of numbers in three.js and there are two problems that appear straight ahead, but I have a few days Still stuck for:

  1. Cloud should be oval shaped with the longest axis on the axis on the x Currently oriented with the x axis
  2. at least axis, while for me the cloud looks exactly elliptic, working in my file There are some points in the le code: y = 0 on the x axis that moves up to the green of their drummer - they have soldiers on y = 0 Stand like. To measure the code> length on either side of the oval (see screenshot below). Both files are in the same math for the ellipse - what's going on here?

    Thank you!

    Code for the oval cloud of digits:

      particleCount = 300; For (var p = 0; p & lt; particleCount; p ++) {// ELLIPTICAL var length = 200; // X (major axis) var width = 75; // y (small axis) var px = (math.rendum () * length); // Solution for length of vertical wire on PX: var wire; Var right entrepreneur = Math Box ((length / 2) - Px); Wire = (2 * length) * math. Class (1 - Math. Exp (2 * Math log) (Right Entry / Width)); Var pY = (Math.Randum () * Wire); Px - = length / 2; // center horizontal pY - = w / 2; // Create the center of the cloud in vertical // END ELLIPTICAL // PX, PE and add to the system   

     The oval cloud of points with misleading particles on both sides

    All errors arise, someone in my misunderstanding of oval equation has helped me. I have corrected the code below that I have realized that I used the dimensions of the axes in those places, where I should have used two different radii. I used some variable names to clarify things Is edited.

      // ELLIPTICAL particle cloud var majorAxis = 200; // X (major axis) var minor Axis = 75; // y (small axis) var majorRadius = majorAxis / 2; Var Chadradius = Small Axis / 2; Var px = (math.rendum () * major axis); // Resolve for the length of the vertical wire on PX: var correct = Monk = Math. Box (Headradius - Px); Var wire = (2 * small radius) * Mathematics. Class (1-Math Exp. (2 * Math Logs (Right Binder / Headache)); Var pY = (Math.Randum () * Wire); PX - = Major Radius; // center horizontal pY - = w / 2; // Create Cloud Particle on Eclipse / Cloud Clock // END ELLIPTICAL // PX, PAR and Add to System   

    Now all should be as follows:

    right oval

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -