There are three points. In the picture, I want to straighten the third point while keeping the edge length. What are the correct methods for vector and matrix arithmetic (Python/R2023)? Thank You.

# Solved Calculate third point position aligned with two points(edge dir)

Here is one of the calculations：

**In world coordinates**, get **ab** vector and the length of **bc** vector

Then **normalize** the **ab** vector , then use the length of the **bc** vector to **scale the length** of the has normalized ab vector , use **point b** world position to **offset** the **ab** vector (that is, add the world position of the **point b** vector) to get the position of point C

file use Xpresso to calculate **C** Position

test.c4d

相信我，可以的！

@chuanzhen said in Calculate third point position aligned with two points(edge dir):

Here is one of the calculations：

In world coordinates, getabvector and the length ofbcvector

Thennormalizetheabvector , then use the length of thebcvector toscale the lengthof the has normalized ab vector , usepoint bworld position tooffsettheabvector (that is, add the world position of thepoint bvector) to get the position of point Cfile use Xpresso to calculate

CPosition

test.c4d

Thanks for the quick reply.

~~How do I change this to run in the local coordinate system?~~

I'm not familiar with the matrix. Thank you.

ah... sorry forget it. remove * mg

Hi @ymoon,

Thanks for reaching out to us. Glad your problem is solved!

Here are some pointers to the docs with related toolset:

c4d.Vector, c4d.Matrix, c4d.utils.

Please note, there's Matrix Manual, although math questions are generally out of scope of the support on this forum.

Cheers,

Ilia

MAXON SDK Specialist

developers.maxon.net