Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New 'Vector Fields' component #47

Closed
jamesleesaunders opened this issue Dec 16, 2018 · 8 comments
Closed

New 'Vector Fields' component #47

jamesleesaunders opened this issue Dec 16, 2018 · 8 comments
Labels
enhancement New feature or request

Comments

@jamesleesaunders
Copy link
Owner

jamesleesaunders commented Dec 16, 2018

Summary

Create new 'Vector Fields' d3-x3d reusable component. Arrows representing flow direction. Also known as Quiver Plot or Velocity Plot.

Detail

Vector fields have many important applications, as they can be used to represent many physical quantities: the vector at a point may represent the strength of some force (gravity, electricity, magnetism) or a velocity (wind speed or the velocity of some other fluid).

Examples

Relevant Files

/src/component/vectorFields.js
/src/chart/vectorFieldChart.js

@jamesleesaunders jamesleesaunders added the enhancement New feature or request label Dec 16, 2018
@jamesleesaunders jamesleesaunders changed the title New Vector Fields component New 'Vector Fields' component Dec 16, 2018
@jamesleesaunders
Copy link
Owner Author

@jamesleesaunders
Copy link
Owner Author

@andreasplesch @JordanDelcros are you able to help me with a problem? I am trying to calculate the yaw, pitch and roll rotation angles needed to rotate a vector arrow between 2 points.

Using x3dom and Vector3 libraries.

I have put my attempts at vector calculations up on Observable here https://beta.observablehq.com/@jamesleesaunders/vector-fields but now all confused.

Any ideas?

@andreasplesch
Copy link
Contributor

andreasplesch commented Jan 21, 2019 via email

@jamesleesaunders
Copy link
Owner Author

jamesleesaunders commented Jan 23, 2019

Thanks @andreasplesch those methods look right up my street!
I'll have a play!

var point1 = new x3dom.fields.SFVec3f(0, 1, 0);   // By default cones are pointing up
var point2 = new x3dom.fields.SFVec3f(2, 1, 3);  // Point you want cone pointing towards
var qDir = x3dom.fields.Quaternion.rotateFromTo(point1, point2);
var rot = qDir.toAxisAngle();
[
   0: {x: -0.7071067811865472, y: 0, z: 0.7071067811865472}, 
   1: 0.9553166181245093
]
var transform = document.getElementById('transform');
transform.setAttribute('rotation', rot[0].x+' '+rot[0].y+' '+rot[0].z+' '+rot[1]);
var matrix = qDir.toMatrix();
[
   _00: 0.7745419205884382
   _01: 0.5345224838248488
   _02: -0.33818711911734267
   _03: 0
   _10: -0.5345224838248488
   _11: 0.2672612419124243
   ...
   _31: 0
   _32: 0
   _33: 1
]
var euler = matrix.getEulerAngles();
[
   1.0197622048947006,
   0.34498984341480937,
   -0.604060432799328,
   -2.1218304486950927,
   2.7966028101749836,
   2.537532220790465"
]

@jamesleesaunders
Copy link
Owner Author

jamesleesaunders commented Feb 4, 2019

Last few niggles:

  • Update Vector fields component example with better data example.
  • If scale > 0 crosshair axis acts funny.
  • If vector coordinate numbers infinite then things go wrong.
  • Observable Reference Error: x3dom not defined.
  • Add unit tests for Vector component and chart.

@jamesleesaunders
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants