Consider a triangle with vertices at (0,0), (1,0), and (0,1). Write a program with an input (x,y) and the output S where S is the string 'outside' if the point (x,y) is outside of the triangle, 'border' if the point is exactly on the border of the triangle, and 'inside' if the point is on the inside of the triangle.

1 Comment

it is false ... it is supposed border not inside ... I think my solution is totally false :(

Sign in to comment.

 Accepted Answer

Steven Lord
Steven Lord on 12 Mar 2018
This sounds like a homework question. If it is a homework question, please show us what you've tried to solve this problem so far and describe where you're having difficulty and we may be able to offer some guidance.
If this is NOT a homework question, rather than writing your own function just call the inpolygon function or (if you're using release R2017b or later) the isinterior function on a polyshape object.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!