Order points on a circle by directional angle
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have several points on a disk with radius of 150. I want to specify an angle and order the points based on the direction of that angle.
I know the coordinates of each point, and I can find the point on the edge of the circle to define the hypotenuse, but I just can't figure out how to get the distance to the perpendicular line "d"
After I calculate the distance of each point (light gray line), I can then order the points from least to greatest distance. I hope this makes sense.
click here to see result image
trigonometry
 |Â
show 2 more comments
up vote
0
down vote
favorite
I have several points on a disk with radius of 150. I want to specify an angle and order the points based on the direction of that angle.
I know the coordinates of each point, and I can find the point on the edge of the circle to define the hypotenuse, but I just can't figure out how to get the distance to the perpendicular line "d"
After I calculate the distance of each point (light gray line), I can then order the points from least to greatest distance. I hope this makes sense.
click here to see result image
trigonometry
1
According to the image, your points lie on a disc, not on a circle.
– Arnaud Mortier
Jul 17 at 23:09
2
What do you mean by "order the points based on the plane of that angle."? What is the plane of an angle? Is there another plane than the one containing the disc?
– Arnaud Mortier
Jul 17 at 23:09
It seems like what you're really asking is for the distance between the bold red line through the origin and the parallel line labeled with "$d,$" rather than some method of ordering points in your circular region/disk. You should probably clarify what exactly it is that you want, and make your title match your question.
– Cameron Buie
Jul 17 at 23:18
1
Is this a programming question? If yes, in many languages (e.g. C/C++) there is a function "atan2(y,x)" which returns the angle to the point (x,y), so you could sort points by angle simply by calling this function. There are also some tricks which avoid trigonometry altogether.
– Zeno Rogue
Jul 17 at 23:31
1
Oh, I think I see what you mean now. A simple solution would be to use the inner product. The inner product of $(x_1,y_1)$ and $(x_2,y_2)$ is $x_1x_2+y_1y_2$. If $(x_2,y_2)$ is a vector of length 1, then the inner product is the length of the projection of $(x_1,y_1)$ on $(0,0)-(x_2,y_2)$ (possibly negative if it falls on the other side). So you just have to order them by the inner product with the intersection of the big red line with the circle.
– Zeno Rogue
Jul 17 at 23:36
 |Â
show 2 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have several points on a disk with radius of 150. I want to specify an angle and order the points based on the direction of that angle.
I know the coordinates of each point, and I can find the point on the edge of the circle to define the hypotenuse, but I just can't figure out how to get the distance to the perpendicular line "d"
After I calculate the distance of each point (light gray line), I can then order the points from least to greatest distance. I hope this makes sense.
click here to see result image
trigonometry
I have several points on a disk with radius of 150. I want to specify an angle and order the points based on the direction of that angle.
I know the coordinates of each point, and I can find the point on the edge of the circle to define the hypotenuse, but I just can't figure out how to get the distance to the perpendicular line "d"
After I calculate the distance of each point (light gray line), I can then order the points from least to greatest distance. I hope this makes sense.
click here to see result image
trigonometry
edited Jul 18 at 5:00
asked Jul 17 at 23:06
user7801
11
11
1
According to the image, your points lie on a disc, not on a circle.
– Arnaud Mortier
Jul 17 at 23:09
2
What do you mean by "order the points based on the plane of that angle."? What is the plane of an angle? Is there another plane than the one containing the disc?
– Arnaud Mortier
Jul 17 at 23:09
It seems like what you're really asking is for the distance between the bold red line through the origin and the parallel line labeled with "$d,$" rather than some method of ordering points in your circular region/disk. You should probably clarify what exactly it is that you want, and make your title match your question.
– Cameron Buie
Jul 17 at 23:18
1
Is this a programming question? If yes, in many languages (e.g. C/C++) there is a function "atan2(y,x)" which returns the angle to the point (x,y), so you could sort points by angle simply by calling this function. There are also some tricks which avoid trigonometry altogether.
– Zeno Rogue
Jul 17 at 23:31
1
Oh, I think I see what you mean now. A simple solution would be to use the inner product. The inner product of $(x_1,y_1)$ and $(x_2,y_2)$ is $x_1x_2+y_1y_2$. If $(x_2,y_2)$ is a vector of length 1, then the inner product is the length of the projection of $(x_1,y_1)$ on $(0,0)-(x_2,y_2)$ (possibly negative if it falls on the other side). So you just have to order them by the inner product with the intersection of the big red line with the circle.
– Zeno Rogue
Jul 17 at 23:36
 |Â
show 2 more comments
1
According to the image, your points lie on a disc, not on a circle.
– Arnaud Mortier
Jul 17 at 23:09
2
What do you mean by "order the points based on the plane of that angle."? What is the plane of an angle? Is there another plane than the one containing the disc?
– Arnaud Mortier
Jul 17 at 23:09
It seems like what you're really asking is for the distance between the bold red line through the origin and the parallel line labeled with "$d,$" rather than some method of ordering points in your circular region/disk. You should probably clarify what exactly it is that you want, and make your title match your question.
– Cameron Buie
Jul 17 at 23:18
1
Is this a programming question? If yes, in many languages (e.g. C/C++) there is a function "atan2(y,x)" which returns the angle to the point (x,y), so you could sort points by angle simply by calling this function. There are also some tricks which avoid trigonometry altogether.
– Zeno Rogue
Jul 17 at 23:31
1
Oh, I think I see what you mean now. A simple solution would be to use the inner product. The inner product of $(x_1,y_1)$ and $(x_2,y_2)$ is $x_1x_2+y_1y_2$. If $(x_2,y_2)$ is a vector of length 1, then the inner product is the length of the projection of $(x_1,y_1)$ on $(0,0)-(x_2,y_2)$ (possibly negative if it falls on the other side). So you just have to order them by the inner product with the intersection of the big red line with the circle.
– Zeno Rogue
Jul 17 at 23:36
1
1
According to the image, your points lie on a disc, not on a circle.
– Arnaud Mortier
Jul 17 at 23:09
According to the image, your points lie on a disc, not on a circle.
– Arnaud Mortier
Jul 17 at 23:09
2
2
What do you mean by "order the points based on the plane of that angle."? What is the plane of an angle? Is there another plane than the one containing the disc?
– Arnaud Mortier
Jul 17 at 23:09
What do you mean by "order the points based on the plane of that angle."? What is the plane of an angle? Is there another plane than the one containing the disc?
– Arnaud Mortier
Jul 17 at 23:09
It seems like what you're really asking is for the distance between the bold red line through the origin and the parallel line labeled with "$d,$" rather than some method of ordering points in your circular region/disk. You should probably clarify what exactly it is that you want, and make your title match your question.
– Cameron Buie
Jul 17 at 23:18
It seems like what you're really asking is for the distance between the bold red line through the origin and the parallel line labeled with "$d,$" rather than some method of ordering points in your circular region/disk. You should probably clarify what exactly it is that you want, and make your title match your question.
– Cameron Buie
Jul 17 at 23:18
1
1
Is this a programming question? If yes, in many languages (e.g. C/C++) there is a function "atan2(y,x)" which returns the angle to the point (x,y), so you could sort points by angle simply by calling this function. There are also some tricks which avoid trigonometry altogether.
– Zeno Rogue
Jul 17 at 23:31
Is this a programming question? If yes, in many languages (e.g. C/C++) there is a function "atan2(y,x)" which returns the angle to the point (x,y), so you could sort points by angle simply by calling this function. There are also some tricks which avoid trigonometry altogether.
– Zeno Rogue
Jul 17 at 23:31
1
1
Oh, I think I see what you mean now. A simple solution would be to use the inner product. The inner product of $(x_1,y_1)$ and $(x_2,y_2)$ is $x_1x_2+y_1y_2$. If $(x_2,y_2)$ is a vector of length 1, then the inner product is the length of the projection of $(x_1,y_1)$ on $(0,0)-(x_2,y_2)$ (possibly negative if it falls on the other side). So you just have to order them by the inner product with the intersection of the big red line with the circle.
– Zeno Rogue
Jul 17 at 23:36
Oh, I think I see what you mean now. A simple solution would be to use the inner product. The inner product of $(x_1,y_1)$ and $(x_2,y_2)$ is $x_1x_2+y_1y_2$. If $(x_2,y_2)$ is a vector of length 1, then the inner product is the length of the projection of $(x_1,y_1)$ on $(0,0)-(x_2,y_2)$ (possibly negative if it falls on the other side). So you just have to order them by the inner product with the intersection of the big red line with the circle.
– Zeno Rogue
Jul 17 at 23:36
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
I figured it out. I rotated the points around the origin(0,0) by (360-given angle). Then the distance to the edge of the disk is the radius (150) minus x. (r-x).
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I figured it out. I rotated the points around the origin(0,0) by (360-given angle). Then the distance to the edge of the disk is the radius (150) minus x. (r-x).
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
add a comment |Â
up vote
0
down vote
I figured it out. I rotated the points around the origin(0,0) by (360-given angle). Then the distance to the edge of the disk is the radius (150) minus x. (r-x).
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I figured it out. I rotated the points around the origin(0,0) by (360-given angle). Then the distance to the edge of the disk is the radius (150) minus x. (r-x).
I figured it out. I rotated the points around the origin(0,0) by (360-given angle). Then the distance to the edge of the disk is the radius (150) minus x. (r-x).
answered Jul 19 at 16:27
user7801
11
11
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
add a comment |Â
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
Great that you have figured this out. Since you have not understood my suggestion, I would like to remark that this is equivalent to 150 minus the inner product of the chosen point and the appropriate vector. For example, for angle=0 the appropriate vector is (1,0) (and thus you simply return 150-1x-0y = 150-x), for angle=90 the appropriate vector is (0,1) (and thus you return 150-0x-1y=150-y), and so on. In general, the appropriate vector is the vector of length 1 in the direction of the big red line.
– Zeno Rogue
Jul 20 at 10:45
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
So basically the inner product is the x coordinate after rotation, and the cross product is the y coordinate.
– Zeno Rogue
Jul 20 at 11:28
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2855012%2forder-points-on-a-circle-by-directional-angle%23new-answer', 'question_page');
);
Post as a guest
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
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
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
1
According to the image, your points lie on a disc, not on a circle.
– Arnaud Mortier
Jul 17 at 23:09
2
What do you mean by "order the points based on the plane of that angle."? What is the plane of an angle? Is there another plane than the one containing the disc?
– Arnaud Mortier
Jul 17 at 23:09
It seems like what you're really asking is for the distance between the bold red line through the origin and the parallel line labeled with "$d,$" rather than some method of ordering points in your circular region/disk. You should probably clarify what exactly it is that you want, and make your title match your question.
– Cameron Buie
Jul 17 at 23:18
1
Is this a programming question? If yes, in many languages (e.g. C/C++) there is a function "atan2(y,x)" which returns the angle to the point (x,y), so you could sort points by angle simply by calling this function. There are also some tricks which avoid trigonometry altogether.
– Zeno Rogue
Jul 17 at 23:31
1
Oh, I think I see what you mean now. A simple solution would be to use the inner product. The inner product of $(x_1,y_1)$ and $(x_2,y_2)$ is $x_1x_2+y_1y_2$. If $(x_2,y_2)$ is a vector of length 1, then the inner product is the length of the projection of $(x_1,y_1)$ on $(0,0)-(x_2,y_2)$ (possibly negative if it falls on the other side). So you just have to order them by the inner product with the intersection of the big red line with the circle.
– Zeno Rogue
Jul 17 at 23:36