Check whether coordinates are in a certain region on a coordinate system
I have a coordinate system with a certain amount of regions, similar to this one:
The difference in my case is however, that all regions are uniquely numbered, are all of the same size and there are 16 of them (so each quadrant would have 4 slices of exactly the same size).
I also have a set of tuples (two dimensional coordinates), which are all between (-1,-1) and (1,1). I'd now like to check into which region (i.e. 1 to 16) they'd land if mapped onto the coordinate system.
As a total beginner, I have no idea on how to tackle this, but here is my approach so far:
Make all the dividing lines functions and check for each point whether they're above and below them. Ignore those on the decision boundary
For example: Quadrant 1 has four regions. From the x-axis to the y-axis (counter-clockwise) let's call them a, b, c and d.
a would be the region between the x-axis and f1(x) = 0.3333x (red)
b between f1 and f2, f2(x) = x (yellow)
c between f2 and f3, f3(x) = 3x (blue)
d between f3 and the y-axis
As code:
def a(p):
if(y > 0 and y < 0.3333x):
return "a"
else:
b(p)
def b(p):
if(y > 0.3333x and y < x)
return "b"
else:
c(p)
def c(p):
if(y > x and y < 3x):
return "c"
else:
d(p)
def d(p):
if(y > 3x and x > 0):
return "d"
Note: for readability's sake I just wrote "x" and "y" for the tuple's respective coordinates, instead p[0] or p[1] every time. Also, as stated above, I'm assuming that there are not items directly on the functions, so those are ignored.
Now, that is a possible solution, but I feel like there's almost certainly a more efficient one.
python coordinates
add a comment |
I have a coordinate system with a certain amount of regions, similar to this one:
The difference in my case is however, that all regions are uniquely numbered, are all of the same size and there are 16 of them (so each quadrant would have 4 slices of exactly the same size).
I also have a set of tuples (two dimensional coordinates), which are all between (-1,-1) and (1,1). I'd now like to check into which region (i.e. 1 to 16) they'd land if mapped onto the coordinate system.
As a total beginner, I have no idea on how to tackle this, but here is my approach so far:
Make all the dividing lines functions and check for each point whether they're above and below them. Ignore those on the decision boundary
For example: Quadrant 1 has four regions. From the x-axis to the y-axis (counter-clockwise) let's call them a, b, c and d.
a would be the region between the x-axis and f1(x) = 0.3333x (red)
b between f1 and f2, f2(x) = x (yellow)
c between f2 and f3, f3(x) = 3x (blue)
d between f3 and the y-axis
As code:
def a(p):
if(y > 0 and y < 0.3333x):
return "a"
else:
b(p)
def b(p):
if(y > 0.3333x and y < x)
return "b"
else:
c(p)
def c(p):
if(y > x and y < 3x):
return "c"
else:
d(p)
def d(p):
if(y > 3x and x > 0):
return "d"
Note: for readability's sake I just wrote "x" and "y" for the tuple's respective coordinates, instead p[0] or p[1] every time. Also, as stated above, I'm assuming that there are not items directly on the functions, so those are ignored.
Now, that is a possible solution, but I feel like there's almost certainly a more efficient one.
python coordinates
1
Are you looking for a ready-made library for cartesian shape operations?
– Charles Landau
Nov 25 '18 at 13:21
Maybe? I don't know to be honest. I just feel like defining 16 very similar functions in order to find out where a point lands on a plane seems rather inefficient.
– Readler
Nov 25 '18 at 13:27
add a comment |
I have a coordinate system with a certain amount of regions, similar to this one:
The difference in my case is however, that all regions are uniquely numbered, are all of the same size and there are 16 of them (so each quadrant would have 4 slices of exactly the same size).
I also have a set of tuples (two dimensional coordinates), which are all between (-1,-1) and (1,1). I'd now like to check into which region (i.e. 1 to 16) they'd land if mapped onto the coordinate system.
As a total beginner, I have no idea on how to tackle this, but here is my approach so far:
Make all the dividing lines functions and check for each point whether they're above and below them. Ignore those on the decision boundary
For example: Quadrant 1 has four regions. From the x-axis to the y-axis (counter-clockwise) let's call them a, b, c and d.
a would be the region between the x-axis and f1(x) = 0.3333x (red)
b between f1 and f2, f2(x) = x (yellow)
c between f2 and f3, f3(x) = 3x (blue)
d between f3 and the y-axis
As code:
def a(p):
if(y > 0 and y < 0.3333x):
return "a"
else:
b(p)
def b(p):
if(y > 0.3333x and y < x)
return "b"
else:
c(p)
def c(p):
if(y > x and y < 3x):
return "c"
else:
d(p)
def d(p):
if(y > 3x and x > 0):
return "d"
Note: for readability's sake I just wrote "x" and "y" for the tuple's respective coordinates, instead p[0] or p[1] every time. Also, as stated above, I'm assuming that there are not items directly on the functions, so those are ignored.
Now, that is a possible solution, but I feel like there's almost certainly a more efficient one.
python coordinates
I have a coordinate system with a certain amount of regions, similar to this one:
The difference in my case is however, that all regions are uniquely numbered, are all of the same size and there are 16 of them (so each quadrant would have 4 slices of exactly the same size).
I also have a set of tuples (two dimensional coordinates), which are all between (-1,-1) and (1,1). I'd now like to check into which region (i.e. 1 to 16) they'd land if mapped onto the coordinate system.
As a total beginner, I have no idea on how to tackle this, but here is my approach so far:
Make all the dividing lines functions and check for each point whether they're above and below them. Ignore those on the decision boundary
For example: Quadrant 1 has four regions. From the x-axis to the y-axis (counter-clockwise) let's call them a, b, c and d.
a would be the region between the x-axis and f1(x) = 0.3333x (red)
b between f1 and f2, f2(x) = x (yellow)
c between f2 and f3, f3(x) = 3x (blue)
d between f3 and the y-axis
As code:
def a(p):
if(y > 0 and y < 0.3333x):
return "a"
else:
b(p)
def b(p):
if(y > 0.3333x and y < x)
return "b"
else:
c(p)
def c(p):
if(y > x and y < 3x):
return "c"
else:
d(p)
def d(p):
if(y > 3x and x > 0):
return "d"
Note: for readability's sake I just wrote "x" and "y" for the tuple's respective coordinates, instead p[0] or p[1] every time. Also, as stated above, I'm assuming that there are not items directly on the functions, so those are ignored.
Now, that is a possible solution, but I feel like there's almost certainly a more efficient one.
python coordinates
python coordinates
asked Nov 25 '18 at 13:08
ReadlerReadler
579
579
1
Are you looking for a ready-made library for cartesian shape operations?
– Charles Landau
Nov 25 '18 at 13:21
Maybe? I don't know to be honest. I just feel like defining 16 very similar functions in order to find out where a point lands on a plane seems rather inefficient.
– Readler
Nov 25 '18 at 13:27
add a comment |
1
Are you looking for a ready-made library for cartesian shape operations?
– Charles Landau
Nov 25 '18 at 13:21
Maybe? I don't know to be honest. I just feel like defining 16 very similar functions in order to find out where a point lands on a plane seems rather inefficient.
– Readler
Nov 25 '18 at 13:27
1
1
Are you looking for a ready-made library for cartesian shape operations?
– Charles Landau
Nov 25 '18 at 13:21
Are you looking for a ready-made library for cartesian shape operations?
– Charles Landau
Nov 25 '18 at 13:21
Maybe? I don't know to be honest. I just feel like defining 16 very similar functions in order to find out where a point lands on a plane seems rather inefficient.
– Readler
Nov 25 '18 at 13:27
Maybe? I don't know to be honest. I just feel like defining 16 very similar functions in order to find out where a point lands on a plane seems rather inefficient.
– Readler
Nov 25 '18 at 13:27
add a comment |
2 Answers
2
active
oldest
votes
Since you're working between (-1,-1)
and (1,1)
coordinates and divinding equaly the cartesian plane, it becomes naturally to use trigonometry functions. Thinking in the unitary circle, which has 2*pi
deegres, you are dividing it in n
equal parts (in this case n = 16
). So each slice has (2*pi)/16 = pi/8
deegres. Now you can imagine an arbitray point (x, y)
connected to the origin point (0, 0)
, it formes an angle with the x-axis. To find this angle you just need to calculate the arc-tangent of y/x
. Then you just need to verify in which angle section it is.
Here is a sketch:
And to directly map to the interval you can use the bisect module:
import bisect
from math import atan2
from math import pi
def find_section(x, y):
# create intervals
sections = [2 * pi * i / 16 for i in range(1, 17)]
# find the angle
angle = atan2(y, x)
# adjusts the angle to the other half circle
if y < 0:
angle += 2*pi
# map into sections
return bisect.bisect_left(sections, angle)
Usage:
In [1]: find_section(0.4, 0.2)
Out[1]: 1
In [2]: find_section(0.8, 0.2)
Out[2]: 0
1
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
2
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
1
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
add a comment |
Shapely is a python library that can help you with typical cartesian geometry, but as far as I know it doesn't have an easy way of extending its Line
objects indefinitely based on a function.
If you're ok with that, then you can check if any Point
is in any Polygon
using the Polygon.contains(Point)
pattern, as shown here: https://shapely.readthedocs.io/en/stable/manual.html#object.contains
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (withwithin
). Sounds a lot better than my approach!
– Readler
Nov 25 '18 at 13:48
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53467767%2fcheck-whether-coordinates-are-in-a-certain-region-on-a-coordinate-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Since you're working between (-1,-1)
and (1,1)
coordinates and divinding equaly the cartesian plane, it becomes naturally to use trigonometry functions. Thinking in the unitary circle, which has 2*pi
deegres, you are dividing it in n
equal parts (in this case n = 16
). So each slice has (2*pi)/16 = pi/8
deegres. Now you can imagine an arbitray point (x, y)
connected to the origin point (0, 0)
, it formes an angle with the x-axis. To find this angle you just need to calculate the arc-tangent of y/x
. Then you just need to verify in which angle section it is.
Here is a sketch:
And to directly map to the interval you can use the bisect module:
import bisect
from math import atan2
from math import pi
def find_section(x, y):
# create intervals
sections = [2 * pi * i / 16 for i in range(1, 17)]
# find the angle
angle = atan2(y, x)
# adjusts the angle to the other half circle
if y < 0:
angle += 2*pi
# map into sections
return bisect.bisect_left(sections, angle)
Usage:
In [1]: find_section(0.4, 0.2)
Out[1]: 1
In [2]: find_section(0.8, 0.2)
Out[2]: 0
1
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
2
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
1
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
add a comment |
Since you're working between (-1,-1)
and (1,1)
coordinates and divinding equaly the cartesian plane, it becomes naturally to use trigonometry functions. Thinking in the unitary circle, which has 2*pi
deegres, you are dividing it in n
equal parts (in this case n = 16
). So each slice has (2*pi)/16 = pi/8
deegres. Now you can imagine an arbitray point (x, y)
connected to the origin point (0, 0)
, it formes an angle with the x-axis. To find this angle you just need to calculate the arc-tangent of y/x
. Then you just need to verify in which angle section it is.
Here is a sketch:
And to directly map to the interval you can use the bisect module:
import bisect
from math import atan2
from math import pi
def find_section(x, y):
# create intervals
sections = [2 * pi * i / 16 for i in range(1, 17)]
# find the angle
angle = atan2(y, x)
# adjusts the angle to the other half circle
if y < 0:
angle += 2*pi
# map into sections
return bisect.bisect_left(sections, angle)
Usage:
In [1]: find_section(0.4, 0.2)
Out[1]: 1
In [2]: find_section(0.8, 0.2)
Out[2]: 0
1
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
2
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
1
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
add a comment |
Since you're working between (-1,-1)
and (1,1)
coordinates and divinding equaly the cartesian plane, it becomes naturally to use trigonometry functions. Thinking in the unitary circle, which has 2*pi
deegres, you are dividing it in n
equal parts (in this case n = 16
). So each slice has (2*pi)/16 = pi/8
deegres. Now you can imagine an arbitray point (x, y)
connected to the origin point (0, 0)
, it formes an angle with the x-axis. To find this angle you just need to calculate the arc-tangent of y/x
. Then you just need to verify in which angle section it is.
Here is a sketch:
And to directly map to the interval you can use the bisect module:
import bisect
from math import atan2
from math import pi
def find_section(x, y):
# create intervals
sections = [2 * pi * i / 16 for i in range(1, 17)]
# find the angle
angle = atan2(y, x)
# adjusts the angle to the other half circle
if y < 0:
angle += 2*pi
# map into sections
return bisect.bisect_left(sections, angle)
Usage:
In [1]: find_section(0.4, 0.2)
Out[1]: 1
In [2]: find_section(0.8, 0.2)
Out[2]: 0
Since you're working between (-1,-1)
and (1,1)
coordinates and divinding equaly the cartesian plane, it becomes naturally to use trigonometry functions. Thinking in the unitary circle, which has 2*pi
deegres, you are dividing it in n
equal parts (in this case n = 16
). So each slice has (2*pi)/16 = pi/8
deegres. Now you can imagine an arbitray point (x, y)
connected to the origin point (0, 0)
, it formes an angle with the x-axis. To find this angle you just need to calculate the arc-tangent of y/x
. Then you just need to verify in which angle section it is.
Here is a sketch:
And to directly map to the interval you can use the bisect module:
import bisect
from math import atan2
from math import pi
def find_section(x, y):
# create intervals
sections = [2 * pi * i / 16 for i in range(1, 17)]
# find the angle
angle = atan2(y, x)
# adjusts the angle to the other half circle
if y < 0:
angle += 2*pi
# map into sections
return bisect.bisect_left(sections, angle)
Usage:
In [1]: find_section(0.4, 0.2)
Out[1]: 1
In [2]: find_section(0.8, 0.2)
Out[2]: 0
edited Nov 26 '18 at 0:36
answered Nov 25 '18 at 13:53
Hemerson TaconHemerson Tacon
1,0531316
1,0531316
1
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
2
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
1
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
add a comment |
1
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
2
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
1
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
1
1
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
Damn, I was actually thinking of dividing the plane into pi/8 and working with the angles, but couldn't think of how to it in Python. Excellent! That's exactly what I had in mind.
– Readler
Nov 25 '18 at 14:02
2
2
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
This is much better. I'll leave my answer up for reference.
– Charles Landau
Nov 25 '18 at 14:24
1
1
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:
angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
While implementing I found a little flaw, as your solution only returns sections in the first quadrant. The "correct" solution to my problem would be:
angle = atan2(y,x) if(y < 0): angle = angle + 2 * pi
– Readler
Nov 25 '18 at 22:32
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
@Readler well noted! Added to solution.
– Hemerson Tacon
Nov 26 '18 at 0:34
add a comment |
Shapely is a python library that can help you with typical cartesian geometry, but as far as I know it doesn't have an easy way of extending its Line
objects indefinitely based on a function.
If you're ok with that, then you can check if any Point
is in any Polygon
using the Polygon.contains(Point)
pattern, as shown here: https://shapely.readthedocs.io/en/stable/manual.html#object.contains
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (withwithin
). Sounds a lot better than my approach!
– Readler
Nov 25 '18 at 13:48
add a comment |
Shapely is a python library that can help you with typical cartesian geometry, but as far as I know it doesn't have an easy way of extending its Line
objects indefinitely based on a function.
If you're ok with that, then you can check if any Point
is in any Polygon
using the Polygon.contains(Point)
pattern, as shown here: https://shapely.readthedocs.io/en/stable/manual.html#object.contains
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (withwithin
). Sounds a lot better than my approach!
– Readler
Nov 25 '18 at 13:48
add a comment |
Shapely is a python library that can help you with typical cartesian geometry, but as far as I know it doesn't have an easy way of extending its Line
objects indefinitely based on a function.
If you're ok with that, then you can check if any Point
is in any Polygon
using the Polygon.contains(Point)
pattern, as shown here: https://shapely.readthedocs.io/en/stable/manual.html#object.contains
Shapely is a python library that can help you with typical cartesian geometry, but as far as I know it doesn't have an easy way of extending its Line
objects indefinitely based on a function.
If you're ok with that, then you can check if any Point
is in any Polygon
using the Polygon.contains(Point)
pattern, as shown here: https://shapely.readthedocs.io/en/stable/manual.html#object.contains
answered Nov 25 '18 at 13:36
Charles LandauCharles Landau
2,6931216
2,6931216
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (withwithin
). Sounds a lot better than my approach!
– Readler
Nov 25 '18 at 13:48
add a comment |
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (withwithin
). Sounds a lot better than my approach!
– Readler
Nov 25 '18 at 13:48
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!
object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (with within
). Sounds a lot better than my approach!– Readler
Nov 25 '18 at 13:48
> it doesn't have an easy way of extending its Line objects indefinitely based on a function. Fortunately that's not needed, as all my points are in one area (between (-1,-1) and (1,1))!
object.within(p)
seems better suited, though. So my new approach would be to create 16 polygons (corresponding to my 16 regions), and then check in which regions a point lands (with within
). Sounds a lot better than my approach!– Readler
Nov 25 '18 at 13:48
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53467767%2fcheck-whether-coordinates-are-in-a-certain-region-on-a-coordinate-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Are you looking for a ready-made library for cartesian shape operations?
– Charles Landau
Nov 25 '18 at 13:21
Maybe? I don't know to be honest. I just feel like defining 16 very similar functions in order to find out where a point lands on a plane seems rather inefficient.
– Readler
Nov 25 '18 at 13:27