I have pointA and pointB in world coordinates. I want to find the pointC which will be perpendicular to line AB.

I Used This code

```
var va = new THREE.Vector3(50, 2, -60)
var vb = new THREE.Vector3(40, 40, 2)
var vc = new THREE.Vector3(50, 2, -60)
var vd = new THREE.Vector3(40,40,2)
vert=[va,vb,vc,vd]
vc.applyAxisAngle(new THREE.Vector3(0,1,0),Math.PI*0.5)
vd.applyAxisAngle(new THREE.Vector3(0,1,0),Math.PI*0.5)
const geo=new THREE.BufferGeometry().setFromPoints(vert)
const mat=new THREE.LineBasicMaterial({color:'red'})
new THREE.Line(geo,mat).position.set(0,0,0)
scene.add(new THREE.Line(geo,mat))
```

The Vector vd exist between points A and B.

two perpendicular line

If you flip any 2 components of the vector (x, y, or z) and multiply one of the flipped components by -1 - you should get a vector orthogonal to the original vector (keeping in mind these vectors can be orthogonal on either axis.)

Easiest to see on 2D vectors:

```
original = [ x , y ]
orthogonal = [ -y , x ]
normalized = [ -y , x ] / sqrt( x^2 + y^2 )
```

1 Like

What does “perpendicular point” mean? In this picture all points C are “penpendicular” to line AB and at the same distance:

I Mean points C intersect the line AB on points called “D” whereas the distance AD=DB and CD perpendicular on line AB.

how can I get the Coordinates of The points C ?

I created two lines with the same coordinates then rotate one of them using this code

```
vc.applyAxisAngle(new THREE.Vector3(0,1,0),Math.PI*0.5)
```

In 3D there are many points C, so that CD is perpendicular to AB and AD=DB. Which C do you want?

I Need the coordinate of points rotated by Math.PI/3 between axis CD and axis x.

It is still not well defined. Depending on the orientation of axis X, there might be from 0 to 4 solutions. Here is an example of calculating of one point C from the circle around D. I hope you can use the code as a starting point to find the actual C that you need.

A, B – blue; D – red; C – yellow

https://codepen.io/boytchev/full/PoyOLGb

My suggestion is to first solve the problem mathematically, and then to make a Three.js program.

I Know how did you find this maybe you used dot product if V(A).dot(V(B))=0 then two line are perpendicular

I Know how did you find this maybe you used dot product if V(A).dot(V(B))=0 then two line are perpendicular that’s why you fliped the orthogonal

This works in 2D, but not in 3D. Try (1,1,1).

This is the best I came up, looking at this explanation :

PS Not sure, if the solution is the desired one at all.