|
|
> Can anyone tell me how I would go about determining if a point will be
> in view given its coordinates and the camera's parameters? See, I'm
> making Antoine's necklace, a fractal object involving a very large
> number of primitives, and they take up way too much memory, but many are
> off the screen.
I'm just doing something very similiar, creating a mesh with the level
of detail depending on the camera position. I'm quite sure there are some
packages which can do the same better, but maybe it gives you an idea.
#declare CAM_POS = <0,0,0>;
#declare CAM_TO = <0,0,10>;
#declare CAM_DIR = vnormalize(CAM_TO - CAM_POS);
#declare CAM_UP = vnormalize(vcross(CAM_DIR, x));
#declare CAM_RIGHT = vcross(CAM_UP, CAM_DIR);
camera {
location CAM_POS
direction CAM_DIR
up CAM_UP
right CAM_RIGHT * 4/3
}
// Change for other FOV, resolution
#macro Project(P, PX, PY)
#declare PX = P.x / P.z;
#declare PY = P.y / P.z;
#end
// Given any position in P, you can now get the exact position on screen
Hope this is helpful
--
#macro C(X,Y)cylinder{X*x<X,0,-Y/2>.1}#end#macro U(R,X,Y)intersection{torus{.9
.1}box{-1 0rotate y*R*90}translate<X,0,Y>scale 1-z*.5}#end union{U(0,0,0)U(1,0
,0)U(2,-1,-1)U(1,1,0)U(1,1.5,-3)U(1,2,0)U(3,1,0)U(2,2,0)U(0,3,0)U(3,2,.5)C(.1,
2)C(.8,1)C(.8,-1)C(1.1,1)C(1.9,-1)pigment{rgb 10}rotate x*90translate<-1,0,4>}
Post a reply to this message
|
|