Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
fracture-flow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
benchmarks
fracture-flow
Commits
cec7b618
Commit
cec7b618
authored
8 years ago
by
Ivar Stefansson
Browse files
Options
Downloads
Patches
Plain Diff
Replace intersections_of_cells.m
parent
9cdf724c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/intersections_of_cells.m
+39
-40
39 additions, 40 deletions
scripts/intersections_of_cells.m
with
39 additions
and
40 deletions
scripts/intersections_of_cells.m
+
39
−
40
View file @
cec7b618
function
[
int_points
]
=
intersections_of_cells
(
line_points
,
...
vertical_line
,
c_p_on
,
c_p_nw_on
)
%UNTITLED5 The matrix int_points contains the intersections with the line
%specified by line_points for each of the cells defined by the points in
%c_p_on. The format for the intersection points is x1,y1,x2,y2
int_points
=
zeros
(
length
(
c_p_on
),
4
);
%length_on = zeros(length(c_p_on));
for
c
=
1
:
length
(
c_p_on
)
ind
=
1
;
% places the points in the right position in the matrix line (c,:)
l
=
length
(
c_p_on
{
c
});
for
v
=
1
:
l
if
v
<
l
i
=
v
+
1
;
% could perhaps be handled with modulus, but =0 has to
%be avoided
else
i
=
1
;
end
% If the two points of a face are on opposite sides of the line,
% the face intersects the line:
if
c_p_nw_on
{
c
}(
v
)
~=
c_p_nw_on
{
c
}(
i
)
face_points
=
[
c_p_on
{
c
}(
v
,:);
c_p_on
{
c
}(
i
,:)];
vertical_face
=
abs
(
c_p_on
{
c
}(
v
,
1
)
-
c_p_on
{
c
}(
i
,
1
))
<
5
*
eps
;
%find intersection points:
int_points
(
c
,
ind
:
ind
+
1
)
=
intersection
(
line_points
,
...
vertical_line
,
face_points
,
...
vertical_face
);
ind
=
ind
+
2
;
end
end
end
end
function
[
intersectionPoints
]
=
intersections_of_cells
(
linePoints
,
...
verticalLine
,
cellPointsOn
,
cellPointsNortWestOn
)
%UNTITLED5 The matrix intersectionPoints contains the intersections with the line
%specified by linePoints for each of the cells defined by the points in
%cellPointsOn. The format for the intersection points is x1,y1,x2,y2
intersectionPoints
=
zeros
(
length
(
cellPointsOn
),
4
);
for
c
=
1
:
length
(
cellPointsOn
)
ind
=
1
;
% places the points in the right position in the matrix line (c,:)
l
=
length
(
cellPointsOn
{
c
});
for
v
=
1
:
l
if
v
<
l
i
=
v
+
1
;
% could perhaps be handled with modulus, but =0 has to
%be avoided
else
i
=
1
;
end
% If the two points of a face are on opposite sides of the line,
% the face intersects the line:
if
cellPointsNortWestOn
{
c
}(
v
)
~=
cellPointsNortWestOn
{
c
}(
i
)
facePoints
=
[
cellPointsOn
{
c
}(
v
,:);
cellPointsOn
{
c
}(
i
,:)];
verticalFace
=
abs
(
cellPointsOn
{
c
}(
v
,
1
)
-
cellPointsOn
{
c
}(
i
,
1
))
<
5
*
eps
;
%find intersection points:
intersectionPoints
(
c
,
ind
:
ind
+
1
)
=
intersection
(
linePoints
,
...
verticalLine
,
facePoints
,
...
verticalFace
);
ind
=
ind
+
2
;
end
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment