I have a need and need a strong mathematical foundation. Knowledge is limited, ask for help, thank you

As shown in the figure, A, B, and C are all known, and now the coordinates of D and E are required. Their Y-axis is equal to 0

%E7%BB%84-1

The dotted lines are all parallel lines of solid lines, and their distances are known.

Can you add/subtract from both x and z axis the distance between the lines? If you only know the distances between a,d, and e then you can divide by math.sqrt(2)?

%E7%BB%84-1

This illustration may be clearer.

If I am understanding your image correctly and you know the position of A. Let’s call it a Vector3 a.
Then
let D = new Vector3(a.x + 2, 0, a.z + 2) and
let E = new Vector3(a.x - 2, 0, a.z - 2)

If that’s not the case, can you draw the X,Y and Z axis? Otherwise I will try for a PG :slight_smile:

Thank you for your answer, but it doesn’t seem to be the result I want. The angle between B, A and C is uncertain. Their position is not uncertain, but it can be determined that their Y-axis is zero. And their normal line is not consistent. There may also be different results. What I may need is a formula.

I think it’s just trigonometry, but I can’t visualize what you are after. Can you make a PG?

This playground that draws a 2D line of given width uses the mathematics you require https://www.babylonjs-playground.com/#FA2H7X#3 . When you want to draw just the dotted lines the data you need is in the two arrays innerData and outerData just delete the mesh building part, build lines instead and rename function https://www.babylonjs-playground.com/#FA2H7X#16.

The maths to find the inner and outer points is at 46 to 49 and then lines 71 - 78. Lines 80 to 90 deal with whether there are just two points or more than two points.

More about lines2D

2 Likes