function pts = WP_find3pts1(a,b,c,d)
%

MAX_DIST = 10^(-14);

p_pt1 = -d*[a,b,c];
pt1 = p_pt1;
pt2 = p_pt1;

count = 0;
while sign([a,b,c]*pt1'+d)==sign([a,b,c]*pt2'+d)
    count = count + 1;
    if count>10^7
        tch = 0;
    end
    pt1 = p_pt1 - 0.5*[a,b,c] + 0.1*rand(1,3);
    pt2 = p_pt1 + 0.5*[a,b,c] + 0.1*rand(1,3);
end

count = 0;

while norm(pt1-pt2)>MAX_DIST
    count = count + 1;
    if count>10^7
        tch = 0;
    end
    ptm = (pt1+pt2)/2;
    if sign([a,b,c]*ptm'+d)==sign([a,b,c]*pt1'+d)
        pt1 = ptm;
    else
        pt2 = ptm;
    end
end
p_pt2 = (pt1+pt2)/2;
p_dir1 = p_pt2 - p_pt1;
p_dir1 = p_dir1/norm(p_dir1);
R = CS5320_gen_R([a;b;c],pi/2);
p_pt3 = (R*p_pt2' + p_pt1')';
p_dir2 = p_pt3 - p_pt1;
p_dir2 = p_dir2/norm(p_dir2);

pts = [p_pt1; p_pt1 + p_dir1; p_pt1 + p_dir2];

tch = 0;
