2d geometry problem .... ?

User avatar
JimC
The sentimental bloke
Posts: 65515
Joined: Thu Feb 26, 2009 7:58 am
About me: To be serious about gin requires years of dedicated research.
Location: Melbourne, Australia
Contact:

Re: 2d geometry problem .... ?

Post by JimC » Wed Mar 11, 2020 7:52 am

Brian Peacock wrote:
Wed Mar 11, 2020 2:10 am
You sure know how to have fun! :D

Again, the problem is not finding the shortest (perpendicular) distance from from any point P within the triangle to any of its sides, but calculating the distance from P to the boundary of the triangle given any value for a.

I think the first Figure B was a visually misleading representation as it looked like a perpendicular intersection, so see the revised Figure B here: viewtopic.php?p=1855598#p1855598
I certainly took it as the perpendicular distance, where the angle is not relevant. It will still be possible to calculate the distance for any line, given the position and the angle, as well (if needed) as the angle at which the line intersects a given side.

I'll have a go at both an angle-based formula, and a spreadsheet some time, but I've got XR stuff tomorrow (a supporting rally outside a courtroom where XR members are facing charges arising from earlier protests), and I have to go to Geelong the next day.
Nurse, where the fuck's my cardigan?
And my gin!

User avatar
NineBerry
Tame Wolf
Posts: 6702
Joined: Thu Feb 26, 2009 1:35 pm
Location: nSk
Contact:

Re: 2d geometry problem .... ?

Post by NineBerry » Wed Mar 11, 2020 4:08 pm

If you have Point P (Px, Py) and angle a, then this is the formula for the line that goes through that point with that angle:

y = (tan(a) * (x - Px)) + Py

Attention, you are not mixing up radiant and degree form of the angle when calculating tangens.

Then you have points C (Cx, Cy) and B (By, By). The line going through these two points gives you this formula:

y = ((By - Cy) / (Bx - Cx) * (x - Cx)) + Cy

Now to get the point X (Xx, Xy) where the two lines intersect, set the formulas equal, solve for x (This is your homework). This is your Xx. Then insert the resulting x in either of the two fomulas to get your Xy.

Having P and X, calculate the distance between the two points.

User avatar
Brian Peacock
Tipping cows since 1946
Posts: 29081
Joined: Thu Mar 05, 2009 11:44 am
About me: Ablate me:
Location: Location: Location:
Contact:

Re: 2d geometry problem .... ?

Post by Brian Peacock » Wed Mar 11, 2020 4:43 pm


NineBerry wrote:... solve for x (This is your homework)...
And don't I know it. But I'm writing it up now....


...oh nose! The dog just threw up on it!

Rationalia relies on voluntary donations. There is no obligation of course, but if you value this place and want to see it continue please consider making a small donation towards the forum's running costs.
Details on how to do that can be found here.

.

"It isn't necessary to imagine the world ending in fire or ice.
There are two other possibilities: one is paperwork, and the other is nostalgia."

Frank Zappa

"This is how humanity ends; bickering over the irrelevant."
Clinton Huxley » 21 Jun 2012 » 14:10:36 GMT
.

User avatar
NineBerry
Tame Wolf
Posts: 6702
Joined: Thu Feb 26, 2009 1:35 pm
Location: nSk
Contact:

Re: 2d geometry problem .... ?

Post by NineBerry » Wed Mar 11, 2020 4:44 pm

This is an example:

https://www.desmos.com/calculator/pblspwchqa

The three black dots make the triangle. The green dot is the point in the middle. Where the black and the red lines intersect is X.

User avatar
Brian Peacock
Tipping cows since 1946
Posts: 29081
Joined: Thu Mar 05, 2009 11:44 am
About me: Ablate me:
Location: Location: Location:
Contact:

Re: 2d geometry problem .... ?

Post by Brian Peacock » Wed Mar 11, 2020 6:04 pm

So then... I broke the problem down into smaller triangles...

I'm using the convention of labelling the vertices of a Triangle in capital Letters and labelling the sides with the lower-case letter of it's opposite vertex. For example, the line between A & B in △ABC would be c : the line between P & B in △BNP would be n etc.

I'm also defining the coordinates of vertices relative to the top left of the image (x = 0, y = 0), and where the x-axis value of A would be labelled Ax and the y-axis value of C would be Cy etc. I think this is less fussy than referring to coordinates with brackets - B(x, y) or A(,y) or N(x,) etc.

Figure C:
.
Figure_C.png
.

What I'm interested in here is △BNP. You can calculate the six properties (three sides, three angles) of any triangle if you know at least three of those properties to start with.

I can work out the length of the line n in △BNP from the coords of P & B with the formula I posted earlier...

△BNP: n = √((Px - Bx)² + (Py - By)²)

Note that the length of n in △BNP is also the length of c in △BCP. Similarly, working out the angle of B in △BCP will give us the angle of B in △BNP. Using the same formula I can calculate the length of c & p in △BCP...

△BCP: c = √((Px - Bx)² + (Py - By)²)
△BCP: b = √((Cx - Px)² + (Cy - Py)²)
△BCP: p = √((Cx - Bx)² + (Cy - By)²)

... and then use the 3-side method to find the angle of B in △BCP, which will also be the angle of B in △BNP...

△BCP: B° = arccos((c² + p² - b²) / (2 × c × p))

That gives me one side n and one angle B in △BNP, so I need one more property to work out the rest - and it can only be angle P.

Because I know the coords can give the distance between B & P on both the horizontal and vertical I can form right-angle triangle with its hypotenuse q along B & P: △BQP in Figure C above. Then its just a matter of using the cosine rule to work out angle P in △BQP...

△BQP: P° = arccos((Px - Bx) / (Py - By))

That gives me a segment of the angle I want, with the remainder being, in this case, the reference angle of a - that is; the angle between the terminal of a and the x-axis. As a terminates in the 3rd quadrant of a circle that means the remainder equals a - 180. This allows me to work out angle P in △BNP by simple addition...

△BNP: P° = arccos((Px - Bx) / (Py - By)) + (a - 180)

So, for the triangle I'm interested in △BNP I now have my three properties: the length of side n and the angles and at either end of it. The interior angles of a triangle add to 180° so finding out angle N is very easy...

△BNP: N° = 180 - (B° + P°)

Now it's just a matter of applying the sine rule, where the lengths of the sides of a triangle divided by the Sines of their opposite angle are always equal...

△BNP: n / sin(N°) = b / sin(B°) = p / sin(P°)

... I don't have a value for p, so ...

△BNP: n / sin(N°) = b / sin(B°)

OR

△BNP: b = (n / sin(N°)) × sin(B°)

The b side of △BNP is the value of d I was looking for. All that pans out to:

d = (√((Px - Bx)² + (Py - By)²) / sin(180 - (arccos((((Px - Bx)² + (Py - By)²) + ((Cx - Bx)² + (Cy - By)²) - ((Px - Bx)² + (Py - By)²)) / (2 × √((Px - Bx)² + (Py - By)²) × √((Cx - Bx)² + (Cy - By)²))) + arccos((Px - Bx) / (Py - By)) + (a - 180)))) × sin(arccos((((Px - Bx)² + (Py - By)²) + ((Cx - Bx)² + (Cy - By)²) - ((Px - Bx)² + (Py - By)²)) / (2 × √((Px - Bx)² + (Py - By)²) × √((Cx - Bx)² + (Cy - By)²))))

However, in order to make a formula out of this that works for every △ABC, point P within it, and possible angle a, I'll have to think about accounting for the quadrants of the main vertices of △ABC fall into in relation to wherever P is along with the terminal of whatever a turns out to be.

Image
Rationalia relies on voluntary donations. There is no obligation of course, but if you value this place and want to see it continue please consider making a small donation towards the forum's running costs.
Details on how to do that can be found here.

.

"It isn't necessary to imagine the world ending in fire or ice.
There are two other possibilities: one is paperwork, and the other is nostalgia."

Frank Zappa

"This is how humanity ends; bickering over the irrelevant."
Clinton Huxley » 21 Jun 2012 » 14:10:36 GMT
.

User avatar
Tero
Just saying
Posts: 34144
Joined: Sun Jul 04, 2010 9:50 pm
About me: Something something birds
Location: USA
Contact:

Re: 2d geometry problem .... ?

Post by Tero » Wed Mar 11, 2020 7:00 pm

ruler.jpg
ruler.jpg (15.33 KiB) Viewed 2309 times
is your triangle real? then use this
http://karireport.blogspot.com/ (:_funny_:)
http://esapolitics.blogspot.com/
coronavirus worldometer https://www.worldometers.info/coronavirus/#countries
Dominus vo-bisque'em Et cum spear a tu-tu, oh!

User avatar
Brian Peacock
Tipping cows since 1946
Posts: 29081
Joined: Thu Mar 05, 2009 11:44 am
About me: Ablate me:
Location: Location: Location:
Contact:

Re: 2d geometry problem .... ?

Post by Brian Peacock » Wed Mar 11, 2020 7:04 pm

No, its conceptual. Geometry in a virtual, bounded 2d space.
Rationalia relies on voluntary donations. There is no obligation of course, but if you value this place and want to see it continue please consider making a small donation towards the forum's running costs.
Details on how to do that can be found here.

.

"It isn't necessary to imagine the world ending in fire or ice.
There are two other possibilities: one is paperwork, and the other is nostalgia."

Frank Zappa

"This is how humanity ends; bickering over the irrelevant."
Clinton Huxley » 21 Jun 2012 » 14:10:36 GMT
.

User avatar
Tero
Just saying
Posts: 34144
Joined: Sun Jul 04, 2010 9:50 pm
About me: Something something birds
Location: USA
Contact:

Re: 2d geometry problem .... ?

Post by Tero » Wed Mar 11, 2020 7:27 pm

Yeah then I don't need to measure it. i can measure length, volume and weight, if I have instruments. The volume was easy. I used to weigh solutions from time to time just to avoid repeatedly having to pour it into a volumetric flask.
http://karireport.blogspot.com/ (:_funny_:)
http://esapolitics.blogspot.com/
coronavirus worldometer https://www.worldometers.info/coronavirus/#countries
Dominus vo-bisque'em Et cum spear a tu-tu, oh!

User avatar
JimC
The sentimental bloke
Posts: 65515
Joined: Thu Feb 26, 2009 7:58 am
About me: To be serious about gin requires years of dedicated research.
Location: Melbourne, Australia
Contact:

Re: 2d geometry problem .... ?

Post by JimC » Wed Mar 11, 2020 8:10 pm

Brian Peacock wrote:
Wed Mar 11, 2020 7:04 pm
No, its conceptual. Geometry in a virtual, bounded 2d space.
But is it flat? If space is curved, then...

:hairfire:
Nurse, where the fuck's my cardigan?
And my gin!

User avatar
Brian Peacock
Tipping cows since 1946
Posts: 29081
Joined: Thu Mar 05, 2009 11:44 am
About me: Ablate me:
Location: Location: Location:
Contact:

Re: 2d geometry problem .... ?

Post by Brian Peacock » Wed Mar 11, 2020 8:18 pm

Tero wrote:
Wed Mar 11, 2020 7:27 pm
Yeah then I don't need to measure it. i can measure length, volume and weight, if I have instruments. The volume was easy. I used to weigh solutions from time to time just to avoid repeatedly having to pour it into a volumetric flask.
But then you're not doing a geometry are you?
JimC wrote:
Wed Mar 11, 2020 8:10 pm
Brian Peacock wrote:
Wed Mar 11, 2020 7:04 pm
No, its conceptual. Geometry in a virtual, bounded 2d space.
But is it flat? If space is curved, then...

:hairfire:
2d or not 2d - that is the question? :whistle:
Rationalia relies on voluntary donations. There is no obligation of course, but if you value this place and want to see it continue please consider making a small donation towards the forum's running costs.
Details on how to do that can be found here.

.

"It isn't necessary to imagine the world ending in fire or ice.
There are two other possibilities: one is paperwork, and the other is nostalgia."

Frank Zappa

"This is how humanity ends; bickering over the irrelevant."
Clinton Huxley » 21 Jun 2012 » 14:10:36 GMT
.

User avatar
JimC
The sentimental bloke
Posts: 65515
Joined: Thu Feb 26, 2009 7:58 am
About me: To be serious about gin requires years of dedicated research.
Location: Melbourne, Australia
Contact:

Re: 2d geometry problem .... ?

Post by JimC » Wed Mar 11, 2020 9:25 pm

2D is 2D, even on a curved surface...
Nurse, where the fuck's my cardigan?
And my gin!

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests