Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411508 Posts in 69374 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 11:00:32 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Distance from point to line in direction 'x'
Pages: [1]
Print
Author Topic: Distance from point to line in direction 'x'  (Read 672 times)
Zack Bell
Level 10
*****



View Profile WWW
« on: September 16, 2014, 01:40:20 PM »

I'm messing up this math somehow. I want to find the distance from a point to a line in a particular direction. It's probably simple, I know I've done it before.



So given that top point and the direction, I want the distance to the floor in that direction.
Logged

zacaj
Level 3
***


void main()


View Profile WWW
« Reply #1 on: September 16, 2014, 01:42:15 PM »

just do a line/line intersection and then find the distance from the intersection point?
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
Zack Bell
Level 10
*****



View Profile WWW
« Reply #2 on: September 16, 2014, 01:46:40 PM »

Yep, did it. Grr. Thanks, haha.
Logged

powly
Level 4
****



View Profile WWW
« Reply #3 on: September 16, 2014, 02:02:56 PM »

If the lines will be parallel and you know the shortest distance between them (let's call it straight_dist, the y difference in the image in the first post) the result you're looking for is Distance = straight_dist/sin(angle) (because sin(angle) = straight_dist/Distance = opposite/hypotenuse). This will probably save some computational costs since you'll have to compute only a sine instead of a sine and cosine for the direction from angle and a square root for the length - though this is probably completely irrelevant for your use case.
Logged
RandyGaul
Level 1
*

~~~


View Profile WWW
« Reply #4 on: September 16, 2014, 03:53:30 PM »

fyi this is raycasting against a plane.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic