Problem 558. Is the Point in a Triangle?
Check whether a point or multiple points is/are in a triangle with three corners
Points = [x, y];
Triangle = [x1, y1; x2, y2; x3, y3]
Return true or false for each point tested.
For example,
input: Points = [0, 0.5]; Triangle = [0, 0; 1, 0; 1, 1]
output: y = 0;
Solution Stats
Problem Comments
-
11 Comments
Show
8 older comments
Asif Newaz
on 19 Oct 2019
it was hard..nic problem
Umur Ulas Harman
on 12 Jul 2020
The test has rounding problems.
ivan fernandez
on 3 Oct 2020
That was hard to me but not impossible. Great!
KATTA PRATYUSHA
on 18 Oct 2020
nice one
but it took so much of time
Roche de Guzman
on 3 Dec 2020
Good problem!
Iris Huang
on 8 Dec 2020
it's soooooo hard
arsenic 陈
on 13 May 2021
tip 组成内部角 和为 360 度
Ben Westcott
on 10 Nov 2021
Interesting problem! Especially hard when everything has to be in one function
Nguyen Trong Hiep
on 1 Apr 2022
Still can't imagine how to solve this one
Hamza Harbi
on 5 Feb 2023
This was an interesting one
Griffin
on 18 Jul 2023
This was honestly pretty fun!
Solution Comments
Show commentsProblem Recent Solvers1557
Suggested Problems
-
Remove any row in which a NaN appears
8587 Solvers
-
How to find the position of an element in a vector without using the find function
2728 Solvers
-
Sum the numbers on the main diagonal
581 Solvers
-
400 Solvers
-
7992 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!