1

우리는 3D 공간에 하나의 반구와 3 개의 삼각형이 있다고 가정합니다. 반구 바닥의 중심점은 C로 표시됩니다. 반구 바닥의 반경은 R로 표시됩니다. 반구 바닥의 법선 벡터는 n으로 표시됩니다.눈으로 볼 수있는 반구 표면의 면적을 추정 하시겠습니까?

첫 번째 삼각형은 V1, V2 및 V3의 세 점으로 표시됩니다. 두 번째 삼각형은 V4, V5 및 V6의 세 점으로 표시됩니다. 세 번째 삼각형은 V7, V8 및 V9의 세 점으로 표시됩니다. 점 V1, V2, ..., V9의 위치는 임의이다. 이제 우리는 눈이 지점 E에 있다고 가정합니다. 삼각형이 눈에서 반구의 표면까지의 시선을 차단할 수 있습니다. 따라서 반구 표면의 일부 영역은 눈으로 보지 못할 수 있습니다.

눈으로 볼 수있는 반구 표면의 면적을 측정하는 방법을 개발하십시오. 여기 반구보다는 구형 코드 :

function r = month_1() 
P1 = [0.918559, 0.750000, -0.918559]; 
P2 = [0.653394, 0.649519, 1.183724]; 
P3 = [-0.918559, -0.750000, 0.918559]; 
P4 = [-0.653394, -0.649519, -1.183724]; 

V1 = [0.989609, -1.125000, 0.071051]; 
V2 = [1.377838, -0.808013, -0.317178]; 
V3 = [1.265766, -0.850481, 0.571351]; 

V4 = [0.989609, -1.125000, 0.071051]; 
V5 = [1.265766, -0.850481, 0.571351]; 
V6 = [0.601381, -1.441987, 0.459279]; 

V7 = [0.989609, -1.125000, 0.071051]; 
V8 = [1.377838, -0.808013, -0.317178]; 
V9 = [0.713453, -1.399519, -0.429250]; 

E = [1.714054, -1.948557, 0.123064]; 

C = [0,1,0]; 
Radius = 2; 
n = [0,1,0]; 

%hold on 
patches.vertices(1,:)= P1; 
patches.vertices(2,:)= P2; 
patches.vertices(3,:)= P3; 
patches.vertices(4,:)= P4; 

patches.vertices(5,:)= V1; 
patches.vertices(6,:)= V2; 
patches.vertices(7,:)= V3; 
patches.vertices(8,:)= V4; 
patches.vertices(9,:)= V5; 
patches.vertices(10,:)= V6; 
patches.vertices(11,:)= V7; 
patches.vertices(12,:)= V8; 
patches.vertices(13,:)= V9; 

patches.faces(1,:)= [5,6,7]; 
patches.faces(2,:)= [8,9,10]; 
patches.faces(3,:)= [11,12,13]; 
patches.faces(4,:)= [1,2,3]; 
patches.faces(5,:)= [1,3,4]; 

patches.facevertexcdata = 1; 
patch(patches); 
shading faceted; view (3); 
% dispatch([1,1,1]) 
hold on 

Num = 20; 
Sum = 0; 
%Srec = norm(cross(P1 - P4, P3 - P4)); 
for i = 1:Num 
    x1 = rand; 
    x2 = rand; 
    v1 = P1-P4; 
    v2 = P3-P4; 
    Samp = P4+v1*x1+v2*x2; 
    ABC = fun_f(E, Samp, V1,V2,V3)*fun_f(E,Samp, V4, V5, V6)*fun_f(E,Samp, V7,V8,V9); 
    Sum = Sum + ABC; 
    % if ABC ==1 
    %  plot3(Samp(1), Samp(2), Samp(3),'r +'), hold on 
    % else 
    %  plot3(Samp(1), Samp(2), Samp(3),'b +'), hold on 
    % end 
%............................ 
[x, y, z]= sphere; 
patches = surf2patch(x,y,z,z); 
patches.vertices(:,3) = abs(patches.vertices(:,3)); 
patches.facevertexcdata = 1; 
patch(patches) 
shading faceted; view(3) 
daspect([1 1 1]) 
%............................ 
end 

%r = Sum/Num; 
%view(31, 15) 
%end 


r = Sum/Num*norm(cross (P1-P4,P3-P4)); 
disp(sprintf('the integration is: %.5f',r)); 
disp(sprintf('the accurate result is: %.5f',norm(cross(P1-P4,P3-P4)/4))); 



function res = fun_f(LineB, LineE, V1, V2, V3) 
O = LineB; 
Len = norm(LineE-LineB); 
v = (LineE-LineB)/Len; 
N = cross(V2-V1, V3-V1)/norm(cross(V2-V1, V3-V1)); 
if dot(N,v)~=0 
    tp = dot(N, V1-O)/ dot(N,v); 
    % if tp >=0 && tp <= (1:3); 
    P = LineB+tp*v(1:3); 

    A = V1 - P; 
    B = V2 - P; 
    Stri1 = norm(cross(A,B))/2; 

    A = V1 - P; 
    B = V3 - P; 
    Stri2 = norm(cross(A,B))/2; 

    A = V3 - P; 
    B = V2 - P; 
    Stri3 = norm(cross(A,B))/2; 

    A = V1 - V2; 
    B = V3 - V2; 
    Stotal = norm(cross(A,B))/2; 

    if (Stri1 + Stri2 + Stri3)> (Stotal + 1e-8) 
     res = 1; 
    else 
     res = 0; 
    end 
else 
    res =1; 
end 
end 
end 

This is the image showing the hemisphere and the triangles occluding the eye

+0

아이디어가 있습니다. 그러나 MatLab이 아닌 수학 만 제공 할 수 있습니다. 니가 원해? –

+0

@willywonkadailyblah 예, 좋습니다. 제발 아이디어를 matlab에 다음 변환합니다. –

답변

1

enter image description here 중심 표면적의 작은 소자 치수 enter image description here보십시오. 지역 요소는

enter image description here

아이디어는 구에서 이러한 요소를 루프입니다 주어진다; 요소의 중심점을 enter image description here에 계산하고이 점과 카메라 사이의 선분이 삼각형과 교차하는 경우 해결하십시오. 더 많은 것 : https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm.

이제 포인트를 찾아야합니다. 이것은 반구 전체에서 enter image description hereenter image description here까지 증가시키는 것을 의미합니다. 그러나이면 샘플링 해상도가 고르지 않게됩니다. enter image description here 요소는 요소를 가장자리보다 반구의 꼭대기 근처에서 훨씬 크게 만듭니다. 대신

:

  • 주위 루프 링의 고정 된 개수를 설정 Nenter image description here의 반복, 즉 개수.

  • 최소값 반복 영역 enter image description here을 설정하십시오.

    enter image description here

enter image description here

    : enter image description here의 반복 횟수는 M

    enter image description hereenter image description hereenter image description here에서 링의 총 면적이다

    의해 gven되고

  • 물론의 증가 위에서는 (그래서 ![![enter image description here에서 시작) enter image description here 각 링의 중간 라인을 제공한다는주의하고, 모든 반지를 통해

    enter image description here

  • 루프에 의해 주어진다; 동일한 우려가 대칭으로 인해 enter image description here에 적용될 필요가 없습니다. 각 enter image description here 위의 각 링 루프에 대해 위에서 언급 한 선 교차 테스트를 수행하십시오.

위의 방법은 작은 enter image description here에서 영역 샘플링 분해능의 편향 량을 감소시킨다.

더 좋은 방법은 피보나치 격자이지만 더 복잡합니다. 이 문서를 참조하십시오 : http://geonaut.eu/published/016_Fibonacci_Lattice.pdf