1

So I have a random point on a canvas that will draw a line to a random point along a line across the bottom of the canvas. From that random point along the bottom of the canvas, I want to draw a line that diverges in the opposite direction (think of it like a " V ").

I'm having a serious issue conceptualizing what I need to do in order to accomplish getting the proper X coordinate for the second line that will be drawn (the Y-Coordinates will obviously be equal). I'm trying to do this using the addLine function in JES

If anyone could point me in the right direction I'd greatly appreciate it

1 Answers1

0

It sounds like you basically want to just make an isosceles triangle here, so that the two legs of your V will be equal, though opposite in angle.

This doesn't define a strict angle between your two legs (which sounds like it's alright), but only that the x distance between both points and your point on the bottom of the canvas is equal.

Specifically, if you've got some code like this:

first_point = (a, b)
bottom_point = (c, d)

You want to make sure that the second_point is parallel though opposite to the first point, so the y coordinate should be the same, and the distance in the x-direction should be the same as the distance to the bottom_point, though in the opposite direction.

third_point_x = c - (a - c)
third_point = (third_point_x, b)

Hope that helps, let me know if you've got any more questions.

Slater Victoroff
  • 21,376
  • 21
  • 85
  • 144