How do you add a 2 dimensional picture (an asymptote picture object) into a three dimensional drawing in asymptote? I have tried add(picture, triple), but it gives no output (no errors, just a blank screen). Full code:

import three;
picture p;
size(p, 300);
path P=polygon(6);
int h, k;
int bigger(int a, int b) {
    if(a >= b) {
        return a;
    else {
        return b;
real distance(pair a, pair b) {
    return sqrt((a.x-b.x)^2+(a.y-b.y)^2);
int bound = 1+bigger(h, k);
pair A=dir(60)+dir(0), B=dir(60)+dir(120);
for(int i = -bound; i<= bound; ++i) {
    for(int j = 0; j <= bound+5; ++j) {
        draw(p,shift((i*A.x, abs(i*A.y))+j*B)*P, blue);
pair C, D;
C = h*A + k*B;
D = rotate(60, (0,0))*C;
draw(p,C--D--(0,0)--cycle, green+linewidth(0.15pt));
real Angle = aTan(C.y/C.x);
add(rotate(-Angle+180)*p, (0,0,0));

This (without including in 3d) produces this:enter image description here I want to place it in three dimensions as the face of a solid, in the end producing something like this:

enter image description here

This may be an unreasonable request, but the reason I need this is because I have drawn a 2d picture as the "pattern" for each face of my 3d solid, and need a way to include it in three dimensions. The reason I had to draw it in 2d was because I needed the clip command, which is not available in 3d.

  • 1
    For clarity, please include a picture/screenshot of the desired output. – Matsmath Jul 26 '16 at 13:11
  • 1
    This can't be done easily, but there are two ways I can think of to approach it. First, you could use the bsp module -- see the picture colorplanes.asy in the Asymptote gallery. Second, you could implement your own clipping using intersections. – Charles Staats Jul 26 '16 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.