4

I have been trying to draw a lattice of a crystal structure with asymptote in 3D environment. I think the vertices should be drawn as a dot command. However, with the projection currentprojection=obliqueX, the dots are not round.

Does anyone have better solutions?

Minimal Settings

settings.render=16;
settings.prc = false;
import three;
size(4cm,0);
currentprojection=obliqueX;
dotfactor=10;
dot(O);
shipout(scale(4.0) *currentpicture.fit());

Output

2
  • A dot is a sphere and then its obliqueX projection is not round ?
    – O.G.
    Mar 4, 2020 at 7:28
  • @O.G. Yes I believe that’s the reason. But what is the right to do?
    – Hance Wu
    Mar 4, 2020 at 15:04

2 Answers 2

5

A sphere x^2+y^2+z^2=1 will not look round in the obliqueX projection, which maps (x,y,z) -> (y-x/2,z-x/2)

To see this, notice that (0,0,0) maps to the (0,0), but (1,0,0) maps to (-1/2,-1/2), (0,1,0) maps to (1,0), which are not equidistant from (0,0).

Use an orthographic projection instead.

2
  • Even though I think that you are right, your considerations do not show this IMHO. You have found two points that are equidistant from the origin in 3d, but their projections have different distances from the projection of O. Such points also exist in an orthographic projection. Anyway, +1 because your main statement is correct.
    – user194703
    Mar 4, 2020 at 7:45
  • I have tried orthographic projection but it is not what a usual lattice looks like. I hope to draw round balls in oblique projection lol.
    – Hance Wu
    Mar 4, 2020 at 15:06
3

Ok, the normal behavior with obliqueX is not a round dot. If necessary it is possible to have (almost) round dot by scaling with respect to x the sphere. To have a size independent of the size picture I have created a pic1 which can be scaled and then included at any point of the picture through add(pic1.fit3(),..).

Please find the following code

    settings.render=16;
    settings.prc = false;
    import three;
    size(4cm,0);
    currentprojection=obliqueX;
    dotfactor=10;
    draw(unitsquare3);
    dot(O);
    picture pic1;
    size(pic1,1cm);
    // to avoid shininess nolight
    draw(pic1,xscale3(1/10)*scale3(1/4)*unitsphere,nolight);

    add(scale3(10)*pic1.fit3(),(0,0.2,0));

I added a global scale3(1/4) so that the scale3(10)*pic1.fit3() gives approximatively a similar size of a dot with 10 as dotfactor.

The picture

enter image description here

With xscale3(1/10) the result is almost perfect, the surface is a flat sphere. A first attempt was with xscale3(1/4) but the result was not perfect. Of course if you have to a more complex picture with multiple colors, the fact that the sphere is flat can produce not realistic picture !

Another solutions: scaling the label("\textbullet"), putting a well oriented unitdisk...

1
  • great! Thanks a lot!
    – Hance Wu
    Mar 5, 2020 at 1:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .