Create Triangle using distance values

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I can't really see what else it could be. Equidistant means Equal Distance. If the points on the triangle are to be of equal distance to each other, then it's an equilateral triangle.

    PandaExplosion, you'll probably need to revisit your high school Trigonometry for this. This is how I would go about it:


    Please login to see this picture.


    Look at the green triangle. You want to find out the x and y lengths, as that will basically tell you how many X and Y pixels away from A you must position C.

    Trigonometry can be used to decipher right-angle triangles; if you know at least 1 acute angle and 1 side length, you can work out the other side lengths. So you split your equilateral triangle into 2, which will create 2 right-angle triangles, including the the pink one in the picture

    You already know all angles of this pink triangle: 90°, 60°, and 30° (60° divided by 2). You can also find out the side length d from Fusion (distance between two points, divided by 2.0)

    Next, find out the length of the side e, which is called the hypotenuse. You can find the equation to do this with google or chatGPT. If you use the 30° angle, then I believe the equation is hypotenuse = opposite/sin(30). In other words, e = d/sin(30)

    You now have one length of the green triangle (e). Now you need to get an angle. Let's get , as shown in the bottom picture.

    First, use Fusion to measure the angle from A to B. This will give you the angle from the horizontal. In other words, it will give you .

    You know that the angle of your equilateral triangle at A is 60°. So 60- will give you

    and together form 90°. So g° = 90-h°

    You now know one side length of the green triangle (the hypotenuse e) and one acute angle (). You can now use the appropriate trigonometric functions to work out the other two sides: the "opposite" x and the "adjacent" y. If I'm not mistaken, it's x = e * sin(g°) and y = e * cos(g°).


    I'm no maths expert, but as far as I know this would be the way to do it. You may need to tweak some things for situations where C is to the left of or above A and/or B.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • Another approach could be, create at design time an equilater triangle, say 10 pixel length for each side. The active object containing such triangle, shoud be a square.
    Then, scale that object accordingly, considering that the width of the active object (the square containing the equilater triangle) is obvious greater than 10 pixel.

    For example, if AB = 20 pixels, then scale the active to (20/10) * (10 / activeObject.width).

    At his point you should rotate the (scaled) active object to match the angle between the points A and B. Then the "triangle", once rotated, should be placed on the right position, so that one side of it overlaps exactly the AB side. This task could be a bit daunting though, and needs further geometric calculation.

    I think Volnaiskra's method is better, even if may involve some calculation extra, because you get the coordinates of the C point, which is what you're looking for. I wanted only point out that there are more ways to accomplish the same task :)

    Regards,
    Sergio

  • I think semar's idea is a good one, and simpler than the trig method. For a slight variation, make a line object like this, with the hotspot at the left and the action point at the right:


    Please login to see this picture.


    Then:

    • place it at A

    • rotate to [angle between A and B] - 60

    scale it so that its length is the same as [distance between A and B].

    Its XactionPoint and YactionPoint should now correspond to the coordinates of the C position of your triangle.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • Here's another simple and purely math-based solution:

    Cx = ((Ax + Bx) * 0.5) + ((By - Ay) * 0.866025404)
    Cy = ((Ay + By) * 0.5) - ((Bx - Ax) * 0.866025404)

    The first part just gives the position of a point half way between A and B.
    An easy way to rotate a vector (in this case, the vector from A to B) by 90 degrees is to invert one of the two components and then swap them, which is what the second part does.
    And finally, the ratio of the length of one of the sides of an equilateral triangle to its height is 0.866025404, so the last part just multiplies by that amount. We can derive that value either by using trigonometry, as Sin(60°), or by using Pythagoras' theorum, as √(1² - 0.5²).

    Theoretically, this method probably ought to be marginally faster, as it doesn't use any trigonometric functions.
    Note also, that there are two valid solutions to the problem, as point C could be to either the left or the right of the line from A to B. The version above is for the first of those, but switching which of the two vector components you invert would give the other:

    Cx = ((Ax + Bx) * 0.5) - ((By - Ay) * 0.866025404)
    Cy = ((Ay + By) * 0.5) + ((Bx - Ax) * 0.866025404)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!