Here's a prototype. The difficulty is that (as I understand it) the clipping is not handled by TeX at all but is done by the final document format (thus it is actually done by the document viewer). So TeX doesn't know what does and doesn't get clipped, if the clipping is done by the usual means, and thus cannot use that information. This means that we have to simulate clipping. To do this, I've use the intersections
library. The idea is that if we have a closed path then a point is inside it if a ray starting at that point and ending at "infinity" crosses the path an odd number of times. This is not 100% accurate: tangencies are problematic, as is "infinity". So we want "infinity" to be "far, far away" and we want some way of choosing the rays to avoid tangencies. I've set "far, far away" to be 10cm (though that's easy enough to modify) and for the rays, I've set it so that you (the user) choose some "centre point" and then all the rays would, if continued in the right direction, pass through that point. By varying that point it should be possible to find one that (for a finite number of nodes) avoids all tangencies.
The last problem is how to implement the decision whether or not a node should be drawn. This is difficult since if we're already processing the node then it's a bit tricky to turn round and say, "Actually, forget it." There are too many different groups and things set up for me to easily figure out how to cancel and close them. Instead, I put a command \ifinside
which looks as though it takes two arguments. The first is the coordinate to consider, the second is the code to include if the coordinate is inside the clipping path (one could easily have an \ifoutside
as well). As a bonus, the coordinate is left as the "current coordinate" so it doesn't have to be respecified inside the arguments. (This could also be modified, also I think a variant where the coordinate considered is the last one mentioned would be useful.)
Putting all that together, we get the following code:
\documentclass{article}
%\url{}
\usepackage{tikz}
\usetikzlibrary{intersections,calc}
\makeatletter
\newdimen\clipper@sx
\newdimen\clipper@sy
\newdimen\clipper@ex
\newdimen\clipper@ey
\newdimen\clipper@len
\def\ifinside#1{%
\pgfextra{%
\tikz@scan@one@point\pgfutil@firstofone#1
\clipper@sx=\pgf@x\relax
\clipper@sy=\pgf@y\relax
\pgfmathsetlength{\clipper@ex}{(\clipper@sx - \pgfkeysvalueof{/tikz/clipper/centre point x})}%
\pgfmathsetlength{\clipper@ey}{(\clipper@sy - \pgfkeysvalueof{/tikz/clipper/centre point y})}%
\pgfmathsetlength{\clipper@len}{veclen(\clipper@ex,\clipper@ey)}%
\pgfmathsetlength{\clipper@ex}{\clipper@sx + 10cm / \clipper@len * \clipper@ex}%
\pgfmathsetlength{\clipper@ey}{\clipper@sy + 10cm / \clipper@len * \clipper@ey}%
\edef\tikz@intersect@path@name@radius{\noexpand\pgfsyssoftpath@movetotoken{\the\clipper@sx}{\the\clipper@sy}\noexpand\pgfsyssoftpath@linetotoken{\the\clipper@ex}{\the\clipper@ey}}%
\tikzset{name intersections={of=clipper@path and radius, total=\clipper@total}}%
\ifodd\clipper@total
\let\clipper@next=\pgfutil@firstofone
\else
\let\clipper@next=\pgfutil@gobble
\fi
\tikz@lastx=\clipper@sx
\tikz@lasty=\clipper@sy
}\clipper@next%
}
\tikzset{
clipper/.style={
name path=clipper@path,
set clipper centre={#1},
},
clipper/centre point x/.initial={0.1},
clipper/centre point y/.initial={0.1},
set clipper centre/.code={%
\def\clipper@temp{#1}%
\ifx\clipper@temp\pgfutil@empty
\else
\tikz@scan@one@point\pgfutil@firstofone#1%
\edef\tikz@marshal{\noexpand\tikzset{%
clipper/centre point x=\the\pgf@x,
clipper/centre point y=\the\pgf@y,
}}%
\tikz@marshal
\fi
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\draw[red,thick,clipper={(0.1,0.1)}] (0,0) circle[radius=3cm];
\foreach \nx in {-4,-3.5,...,4} {
\foreach \ny in {-4,-3.5,...,4} {
\fill[green] (\nx,\ny) circle[radius=1pt];
\path \ifinside{(\nx,\ny)}{node[draw] {a}};
}
}
\end{tikzpicture}
\end{document}
with result:

I haven't tested it rigorously, though there's nothing wrong with the theory! Moreover, it is slow. But then it's going to have to be to do this with a reasonable degree of accuracy.
clipping
tag here, but I am unable to create new one (rep < 300).