In three.js scene i have LineLoop across 6 points located as plane on picture. And i heed to rotate it around vector A'B' (green rounded arrow).
My pipline:
- Calc points vectors
let pointVector = new Vector3().fromArray([x, y, z])
- Set vector for movemnet
const move = new Vector3(xMove, yMove, zMove)
- Set vector for rotation direction
const zNormalVector = new THREE.Vector3(0, 0, 1)
- Set angle for rotation
const zAngle = Math.PI/6
- Calc quaternion with vector and angle
const zQuaternion = new Quaternion().setFromAxisAngle(zNormalVector, zAngle)
- Add move vector to every points from 1.
pointVector.add(move)
- Apply quaternion to every points from 1.
pointVector.applyQuaternion(zQuaternion)
With the operation "movement" everything is ok, but the operation "rotation" puzzled me.
Obviously, the exact execution of this algorithm results in rotation along the red arrow instead of the green one.
Specifying a rotation vector with an increased coordinate Y leads to the fact that the axis of rotation is tilted, not moved, and I did not find how to set the starting point of the vector in the documentation.
Perhaps a similar problem can be solved through the .worldToLocal and .localToWorld methods, but Vector3 is not an instance of Object3D
UPD 1 In docs i found: A direction and length in 3D space. In three.js the length will always be the Euclidean distance (straight-line distance) from (0, 0, 0) to (x, y, z) and the direction is also measured from (0, 0, 0) towards (x, y, z).
It means my question has no answer. But how i can rotate my object like green arrow?