1

3D空間内に半球と三角形が1つあると仮定します。半球の底の中心点はCで示される。半球の底の半径はRで表される。半球の底面に対する法線ベクトルはnで示される。目で見ることができる半球面の面積の量を見積もりますか?

最初の三角形は、V1、V2、V3の3点で与えられます。第2の三角形は、3つの点V4、V5、V6によって与えられる。三つ目の三角は、V7、V8、V9の3点で与えられる。点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係数は、要素を端よりも半球の頂点の近くではるかに大きくします。代わり

:周りにループにリングの固定数Nを設定

  • enter image description hereの反復、すなわち数。

  • を最小値の反復領域enter image description hereに設定します。

    enter image description here

enter image description here

    enter image description hereの反復回数、 Menter image description hereenter image description hereにおけるリングの総面積である

    enter image description here

    によってgvenれます

  • もちろんの増分上方からは、(SO ![![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

関連する問題