I need to draw points on the torus. 3D dot is not helpful since they are spheres. I successfully calculate the norm vectors and draw the circles on the torus, which I will fill later.

As one can see the torus is opaque, and the circles are all drawn normally. Is there a way to make, normally invisible circles, opaque?

One solution in my mind is, make a line to the perspective point from the center of the small circles and calculate the intersection points with the torus. If the distance of the point is the smallest then paint the circle normally, otherwise, paint it opaque.

Is there any better solution?

[![enter image description here](https://i.stack.imgur.com/bxTO4.png)](https://i.stack.imgur.com/bxTO4.png)

```
settings.outformat="pdf";

settings.prc=false;
settings.render=0;

import graph3;

size(4cm,0);

pen surfPen=white+opacity(0.2);
pen xarcPen=deepblue+0.7bp;
pen yarcPen=deepred+0.7bp;

currentprojection=perspective(5,5,6);

real R=3;       //Radius of big circle
real a=1;       //Radius of little circle

triple fs(pair t) {
  return ((R+a*Cos(t.y))*Cos(t.x),(R+a*Cos(t.y))*Sin(t.x),a*Sin(t.y));
}

triple centerXYNormal(pair t) {

  triple P = (((R)*Cos(t.x)),(R)*Sin(t.x),0);
  triple T = fs(t);
  return (T.x - P.x, T.y - P.y, T.z - P.z);

}

surface s=surface(fs,(0,0),(360,360),8,8,Spline);
draw(s,surfPen,render(compression=Low,merge=true));

int m=3;
int n=16;

pair p,q,v;

for(int i=1;i<=n;++i){
  for(int j=0;j<m;++j){
    p=(j*360/m,(i%n)*360/n);
    path3 mycircle = circle(c=fs(p), r=0.1,normal=centerXYNormal(p));
    draw(mycircle, blue);
  }
}

```