Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by slammin · Jan 04, 2017 at 07:12 PM · mathpointslinestriangleperpendicular

Finding a specific point on the edge of a triangle

Hello everyone! So, we have a triangle composed by points a, b, and c in 3D space. The point we are trying to find is point p and it is on the line segment between a and b. However, the one other defining characteristic of point p is that the line segment it creates with point c is perpendicular to a and b. Please take a look at the attached picture for greater clarity.

alt text

A solution I can't seem to see through was to get the plane's normal (n1) by cross product ca with cb.

n1 = ca cross cb

Then, cross product this normal with ab to get all vectors that are perpendicular to ab (including pc).

n2 = n1 cross ab

Because pc is parallel to n2, it would seem that the vector n2 could be a key to solving this puzzle. Additionally, the dot product of n2 and pc would be the positive or negative magnitude of both vectors multiplied together.

n2 dot pc = (+/-)(magnitude of n2)(magnitude of pc)

Also, when we dot product pc with n1, the result should also be zero (because pc is perpendicular to n1):

n1 dot pc = 0

I'm pretty sure both of the dot products are instrumental in finding out the x, y, and z values of p. Maybe another solution would simply be by setting the line pc equal to the line ab. Or, a combination of setting the lines equal to each-other (getting the intersection point) and these cross/dot product identities. Can someone help me out here and remind me how to do this?

Thanks for your time and help!

findpointp.jpg (48.4 kB)
Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alexanderameye · Jan 04, 2017 at 11:16 PM 1
Share

Couldn't you try the following approach:

You have the coordinates of a, b and c in 3D space. Run a loop that checks every point on the vector ab going from a to b, and for each point, check the angle between the vector ab and the vector pc with p the current point you're checking. If the angle is 90 degrees, stop the loop and return the 3D coordinates of point p. Of course checking every point between a and b is impossible since there are infinite points so you might have to use a threshold, let's say move every point p with 0.01f each time and check if the angle is between 89.9 and 90.1 degrees. I hope this helps you out a bit

avatar image slammin · Jan 04, 2017 at 11:50 PM 0
Share

Hey $$anonymous$$, I posted this same question on stack exchange as well and got the perfect answer over there. Your answer would be a good one to save time if there weren't a better answer. It turns out that point p is simply the projection of ac onto ab! And there is a function in Unity that actually does projections. So, I will update this post with an answer. Thank you for your response, however!

avatar image alexanderameye · Jan 04, 2017 at 11:53 PM 0
Share

Awesome! I didn't know about that function so thank you for sharing. Good luck with your project!

avatar image slammin alexanderameye · Jan 05, 2017 at 12:07 AM 0
Share

Thank man, you too!

avatar image hdtnl slammin · Jan 05, 2017 at 01:16 AM 1
Share

yep, thank you, i know that function, i was try some example, but it worked dont like i was expect :(

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by slammin · Jan 05, 2017 at 07:01 AM

This is the answer -- which I got from stack exchange after I posted this question there too.

It turns out that point p is the projection of ac onto ab! And, there is a projection function in Unity that solves this problem marvelously. So:

1) add the projection of ac onto ab to point a

alt text


findpointpanswer.jpg (97.3 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I calculate how far along a point is in relation to a line, when the point is not on the line? 1 Answer

How to create vector within triangle plane, from perpendiculor vector3 1 Answer

Calculating a right triangle trouble... 2 Answers

Calculating triangle side length based on hypotenuse? 1 Answer

calculus help angels of a triangle 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges