How to find the intersection of two `path3[]`
up vote
7
down vote
favorite
I'm using Asymptote to draw some figures and I need to put a dot on the intersection of two path3
but the command intersectionpoint()
doesn't work for path3
. What can I do?
intersections asymptote
add a comment |
up vote
7
down vote
favorite
I'm using Asymptote to draw some figures and I need to put a dot on the intersection of two path3
but the command intersectionpoint()
doesn't work for path3
. What can I do?
intersections asymptote
I am not familiar with this package but those who are will need to see a minimum working example in order to trouble shot your problem. This includes the preamble, begin and end document, and a small re-creation of the issue.
– dustin
Jul 26 '13 at 14:45
add a comment |
up vote
7
down vote
favorite
up vote
7
down vote
favorite
I'm using Asymptote to draw some figures and I need to put a dot on the intersection of two path3
but the command intersectionpoint()
doesn't work for path3
. What can I do?
intersections asymptote
I'm using Asymptote to draw some figures and I need to put a dot on the intersection of two path3
but the command intersectionpoint()
doesn't work for path3
. What can I do?
intersections asymptote
intersections asymptote
asked Jul 26 '13 at 14:23
user2482876
3531312
3531312
I am not familiar with this package but those who are will need to see a minimum working example in order to trouble shot your problem. This includes the preamble, begin and end document, and a small re-creation of the issue.
– dustin
Jul 26 '13 at 14:45
add a comment |
I am not familiar with this package but those who are will need to see a minimum working example in order to trouble shot your problem. This includes the preamble, begin and end document, and a small re-creation of the issue.
– dustin
Jul 26 '13 at 14:45
I am not familiar with this package but those who are will need to see a minimum working example in order to trouble shot your problem. This includes the preamble, begin and end document, and a small re-creation of the issue.
– dustin
Jul 26 '13 at 14:45
I am not familiar with this package but those who are will need to see a minimum working example in order to trouble shot your problem. This includes the preamble, begin and end document, and a small re-creation of the issue.
– dustin
Jul 26 '13 at 14:45
add a comment |
1 Answer
1
active
oldest
votes
up vote
9
down vote
accepted
Built-in three-dimensional version of the
function intersectionpoints
returns an array of intersection points
of the two 3d
paths. To get the intersections
of two path3
arrays,
a simple function intersectionpoints3
can be used,
that checks and accumulates all combinations of the intersection points:
import three;
currentprojection=orthographic(camera=(-5,1.5,4),up=Y,target=O,zoom=1);
triple intersectionpoints3(path3 p,path3 q){
triple r=new triple;
triple s;
for(path3 pk:p){
for(path3 qj:q){
s=intersectionpoints(pk,qj);
if(s.length>0)r.append(s);
}
}
return r;
}
size(200);
path3 p=box(O,(1,1,1));
path3 q=(-0.5,0,0.5)--(1.5,0,0.5)..(2,0.5,0.5)..(1.5,1,0.5)
^^(1.5,1,0.5)--(-0.5,1,0.5)..(-1,0.5,0.5)..(-0.5,0,0.5);
draw(p,darkblue);
draw(q,orange);
dot(intersectionpoints3(p,q),red);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
9
down vote
accepted
Built-in three-dimensional version of the
function intersectionpoints
returns an array of intersection points
of the two 3d
paths. To get the intersections
of two path3
arrays,
a simple function intersectionpoints3
can be used,
that checks and accumulates all combinations of the intersection points:
import three;
currentprojection=orthographic(camera=(-5,1.5,4),up=Y,target=O,zoom=1);
triple intersectionpoints3(path3 p,path3 q){
triple r=new triple;
triple s;
for(path3 pk:p){
for(path3 qj:q){
s=intersectionpoints(pk,qj);
if(s.length>0)r.append(s);
}
}
return r;
}
size(200);
path3 p=box(O,(1,1,1));
path3 q=(-0.5,0,0.5)--(1.5,0,0.5)..(2,0.5,0.5)..(1.5,1,0.5)
^^(1.5,1,0.5)--(-0.5,1,0.5)..(-1,0.5,0.5)..(-0.5,0,0.5);
draw(p,darkblue);
draw(q,orange);
dot(intersectionpoints3(p,q),red);
add a comment |
up vote
9
down vote
accepted
Built-in three-dimensional version of the
function intersectionpoints
returns an array of intersection points
of the two 3d
paths. To get the intersections
of two path3
arrays,
a simple function intersectionpoints3
can be used,
that checks and accumulates all combinations of the intersection points:
import three;
currentprojection=orthographic(camera=(-5,1.5,4),up=Y,target=O,zoom=1);
triple intersectionpoints3(path3 p,path3 q){
triple r=new triple;
triple s;
for(path3 pk:p){
for(path3 qj:q){
s=intersectionpoints(pk,qj);
if(s.length>0)r.append(s);
}
}
return r;
}
size(200);
path3 p=box(O,(1,1,1));
path3 q=(-0.5,0,0.5)--(1.5,0,0.5)..(2,0.5,0.5)..(1.5,1,0.5)
^^(1.5,1,0.5)--(-0.5,1,0.5)..(-1,0.5,0.5)..(-0.5,0,0.5);
draw(p,darkblue);
draw(q,orange);
dot(intersectionpoints3(p,q),red);
add a comment |
up vote
9
down vote
accepted
up vote
9
down vote
accepted
Built-in three-dimensional version of the
function intersectionpoints
returns an array of intersection points
of the two 3d
paths. To get the intersections
of two path3
arrays,
a simple function intersectionpoints3
can be used,
that checks and accumulates all combinations of the intersection points:
import three;
currentprojection=orthographic(camera=(-5,1.5,4),up=Y,target=O,zoom=1);
triple intersectionpoints3(path3 p,path3 q){
triple r=new triple;
triple s;
for(path3 pk:p){
for(path3 qj:q){
s=intersectionpoints(pk,qj);
if(s.length>0)r.append(s);
}
}
return r;
}
size(200);
path3 p=box(O,(1,1,1));
path3 q=(-0.5,0,0.5)--(1.5,0,0.5)..(2,0.5,0.5)..(1.5,1,0.5)
^^(1.5,1,0.5)--(-0.5,1,0.5)..(-1,0.5,0.5)..(-0.5,0,0.5);
draw(p,darkblue);
draw(q,orange);
dot(intersectionpoints3(p,q),red);
Built-in three-dimensional version of the
function intersectionpoints
returns an array of intersection points
of the two 3d
paths. To get the intersections
of two path3
arrays,
a simple function intersectionpoints3
can be used,
that checks and accumulates all combinations of the intersection points:
import three;
currentprojection=orthographic(camera=(-5,1.5,4),up=Y,target=O,zoom=1);
triple intersectionpoints3(path3 p,path3 q){
triple r=new triple;
triple s;
for(path3 pk:p){
for(path3 qj:q){
s=intersectionpoints(pk,qj);
if(s.length>0)r.append(s);
}
}
return r;
}
size(200);
path3 p=box(O,(1,1,1));
path3 q=(-0.5,0,0.5)--(1.5,0,0.5)..(2,0.5,0.5)..(1.5,1,0.5)
^^(1.5,1,0.5)--(-0.5,1,0.5)..(-1,0.5,0.5)..(-0.5,0,0.5);
draw(p,darkblue);
draw(q,orange);
dot(intersectionpoints3(p,q),red);
answered Jul 26 '13 at 18:12
g.kov
17.1k13975
17.1k13975
add a comment |
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f125565%2fhow-to-find-the-intersection-of-two-path3%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
I am not familiar with this package but those who are will need to see a minimum working example in order to trouble shot your problem. This includes the preamble, begin and end document, and a small re-creation of the issue.
– dustin
Jul 26 '13 at 14:45