Commit 4e2e5e74 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Reworking point outside wedge and point facing main/opposite side functions

parent e0d7c2d3
function b = point_outside_wedge( obj, point ) function b = point_outside_wedge( obj, point )
% Returns true if the point is outside the solid structure of % point_outside_wedge Returns true if the point is outside the solid structure of
% the finite wedge % the finite wedge
%
% Example: b = w.point_outside_wedge( point )
%
dim = size( point ); assert( all( size( point ) == size( obj.location ) ) )
if dim(2) ~= 3 assert( abs( norm( obj.main_face_normal ) - 1 ) < obj.set_get_geo_eps )
if dim(1) ~= 3 assert( abs( norm( obj.opposite_face_normal ) - 1 ) < obj.set_get_geo_eps )
error( 'Point(s) must be of dimension 3')
end % Use Hesse normal form
point = point'; d1 = dot( point - obj.location, obj.main_face_normal );
dim = size( point ); d2 = dot( point - obj.location, obj.opposite_face_normal );
end
dist_from_main_face = sum( (point - obj.location) .* obj.main_face_normal, 2 ); % Bad error propagation for face normals ... use a very soft resolution
dist_from_opposite_face = sum( (point - obj.location) .* obj.opposite_face_normal, 2 ); % for a point beeing inside or outside a wedge.
b = any( [ d1 d2 ] > (-2) * obj.set_get_geo_eps);
b = zeros( dim(1), 1 );
mask = ( dist_from_main_face < -obj.set_get_geo_eps ) & ( dist_from_opposite_face < -obj.set_get_geo_eps );
b(~mask) = true;
end end
function res = point_facing_main_side( obj, point ) function res_t = point_facing_main_side( obj, point )
% Returns string including the face normal of source % Returns string including the face normal of source
% facing wedge side % facing wedge side
% output: 'n1' -> source is facing main face of wedge % output: 'n1' -> source is facing main face of wedge
% 'n2' -> source is facing opposite face of wedge % 'n2' -> source is facing opposite face of wedge
%% Assertions if ~obj.point_outside_wedge( point )
dim = size( point );
if dim(2) ~= 3
if dim(1) ~= 3
error( 'Position vectors must be of dimension 3!' );
end
%point = point';
dim = size( point );
end
if any( ~obj.point_outside_wedge( point ) )
error( 'Source position(s) must be outside the wedge!' ); error( 'Source position(s) must be outside the wedge!' );
end end
...@@ -44,8 +35,10 @@ y_i2 = dot( point - obj.location, e_y2, 2 ); ...@@ -44,8 +35,10 @@ y_i2 = dot( point - obj.location, e_y2, 2 );
temp2 = atan2( y_i2, x_i2 ); temp2 = atan2( y_i2, x_i2 );
temp2( temp2 < 0 ) = temp2( temp2 < 0 ) + 2*pi; temp2( temp2 < 0 ) = temp2( temp2 < 0 ) + 2*pi;
res = true( dim(1), 1 ); res_t = true( 3, 1 );
res( temp2 < temp1 ) = false; res_t( temp2 < temp1 ) = false;
res = any( res_t );
end end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment