Thanks for the responses.
@Librarian
I couldn't quite directly use it since I guess the code is for the mat context.
That said I think I get the overall logic. I think its doing Method #2 in the code below.
@animatrix
The code works as expected.
==========
Also just for reference. People from slack group also helped me. Here are the results.
Same goal just different execution.
Method 1 (from bcarmeli)
vector @cdir;
vector @raydir;
matrix camMatrix = optransform(chs("camera"));
//get a matrix with the camera's transforms.
@cdir = cracktransform(0, 0, 0, {0,0,0}, camMatrix);
//extract out the camera position as a vector
@raydir = normalize(@P-@cdir);
//get a vector to project pointo from camera
f@facing_ratio = fit11(dot(@N, @raydir),0,1);
if(@facing_ratio>chf("threshold")){
@group_mygroup = 1;
}
Method 2 (from David Torno)
vector cam = getpointbbox_center(1);
//Option 1: Get dir per point
vector dir = normalize(@P - cam);
//Option 2: Get single point centroid
//vector c = getpointbbox_center(0);
//vector dir = normalize(@P - c);
float d = fit11(dot(@N, dir), 0, 1);
if(d > chf("threshold"))i@group_mygroup =1;
Will close this thread now. Thanks for the help!