Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

27 lignes
952B

  1. // Curve settings
  2. var curveProperties = {
  3. splineDensity: 10,
  4. curvature: 100
  5. };
  6. // Add a curved edge between two points
  7. function makeEdge(start, end) {
  8. // Make the geometry of the curve
  9. //var a = new THREE.Vector3(start.x, start.y, start.z);
  10. //var b = new THREE.Vector3(end.x, end.y, end.z);
  11. var a = start;
  12. var b = end;
  13. var length = new THREE.Vector3().subVectors(a, b).length();
  14. var bend = new THREE.Vector3(length / curveProperties.curvature, length / curveProperties.curvature, 0);
  15. var mid = new THREE.Vector3().add(a).add(b).multiplyScalar(0.5).add(bend);
  16. var spline = new THREE.CatmullRomCurve3([a, mid, b]);
  17. var geometry = new THREE.Geometry();
  18. var splinePoints = spline.getPoints(curveProperties.splineDensity);
  19. Array.prototype.push.apply(geometry.vertices, splinePoints);
  20. // Make the actual Object3d thing
  21. var line = new THREE.Line(geometry, materials.edge);
  22. return line;
  23. }