Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Development
openfoam
Commits
aacf2ca0
Commit
aacf2ca0
authored
9 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
BUG: searchableCone: fixed hollowness and radius1=radius2
parent
b5b3ab9f
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
src/meshTools/searchableSurface/searchableCone.C
+51
-31
51 additions, 31 deletions
src/meshTools/searchableSurface/searchableCone.C
with
51 additions
and
31 deletions
src/meshTools/searchableSurface/searchableCone.C
+
51
−
31
View file @
aacf2ca0
...
...
@@ -162,7 +162,7 @@ void Foam::searchableCone::findNearest
normalCone
/=
mag
(
normalCone
);
}
if
(
innerRadius1_
>
0
&&
innerRadius2_
>
0
)
if
(
innerRadius1_
>
0
||
innerRadius2_
>
0
)
{
// Same for inner radius
point
iCprojPt1
=
point1_
+
innerRadius1_
*
v
;
...
...
@@ -319,8 +319,8 @@ Foam::scalar Foam::searchableCone::radius2
}
// From
http://www.gamedev.net/community/forums/topic.asp?topic_id=467789 -
//
intersection of cylinder with ray
// From
mrl.nyu.edu/~dzorin/rend05/lecture2.pdf,
//
Ray Tracing II, Infinite cone ray intersection.
void
Foam
::
searchableCone
::
findLineAll
(
const
searchableCone
&
cone
,
...
...
@@ -445,33 +445,53 @@ void Foam::searchableCone::findLineAll
}
vector
va
=
cone
.
unitDir_
;
point
pa
=
cone
.
unitDir_
*
cone
.
radius1_
*
mag
(
cone
.
point2_
-
cone
.
point1_
)
/
(
cone
.
radius1_
-
cone
.
radius2_
)
+
cone
.
point1_
;
// Second order equation of the form a*t^2 + b*t + c
scalar
a
,
b
,
c
;
scalar
deltaRadius
=
cone
.
radius2_
-
cone
.
radius1_
;
scalar
l2
=
sqr
(
deltaRadius
)
+
sqr
(
cone
.
magDir_
);
scalar
sqrCosAlpha
=
sqr
(
cone
.
magDir_
)
/
l2
;
scalar
sqrSinAlpha
=
sqr
(
deltaRadius
)
/
l2
;
vector
delP
(
start
-
pa
);
vector
v1
(
end
-
start
);
v1
=
v1
/
mag
(
v1
);
scalar
p
=
(
va
&
v1
);
vector
a1
=
(
v1
-
p
*
va
);
vector
p1
=
(
delP
-
(
delP
&
va
)
*
va
);
const
scalar
a
=
sqrCosAlpha
*
((
v1
-
p
*
va
)
&
(
v1
-
p
*
va
))
-
sqrSinAlpha
*
p
*
p
;
const
scalar
b
=
2
.
0
*
sqrCosAlpha
*
(
a1
&
p1
)
-
2
.
0
*
sqrSinAlpha
*
(
v1
&
va
)
*
(
delP
&
va
);
const
scalar
c
=
sqrCosAlpha
*
((
delP
-
(
delP
&
va
)
*
va
)
&
(
delP
-
(
delP
&
va
)
*
va
))
-
sqrSinAlpha
*
sqr
(
delP
&
va
);
if
(
mag
(
deltaRadius
)
<=
ROOTVSMALL
)
{
vector
point1Start
(
start
-
cone
.
point1_
);
const
vector
x
=
point1Start
^
cone
.
unitDir_
;
const
vector
y
=
V
^
cone
.
unitDir_
;
const
scalar
d
=
sqr
(
0
.
5
*
(
cone
.
radius1_
+
cone
.
radius2_
));
a
=
(
y
&
y
);
b
=
2
*
(
x
&
y
);
c
=
(
x
&
x
)
-
d
;
}
else
{
vector
va
=
cone
.
unitDir_
;
vector
v1
(
end
-
start
);
v1
=
v1
/
mag
(
v1
);
scalar
p
=
(
va
&
v1
);
vector
a1
=
(
v1
-
p
*
va
);
// Determine the end point of the cone
point
pa
=
cone
.
unitDir_
*
cone
.
radius1_
*
mag
(
cone
.
point2_
-
cone
.
point1_
)
/
(
-
deltaRadius
)
+
cone
.
point1_
;
scalar
l2
=
sqr
(
deltaRadius
)
+
sqr
(
cone
.
magDir_
);
scalar
sqrCosAlpha
=
sqr
(
cone
.
magDir_
)
/
l2
;
scalar
sqrSinAlpha
=
sqr
(
deltaRadius
)
/
l2
;
vector
delP
(
start
-
pa
);
vector
p1
=
(
delP
-
(
delP
&
va
)
*
va
);
a
=
sqrCosAlpha
*
((
v1
-
p
*
va
)
&
(
v1
-
p
*
va
))
-
sqrSinAlpha
*
p
*
p
;
b
=
2
.
0
*
sqrCosAlpha
*
(
a1
&
p1
)
-
2
.
0
*
sqrSinAlpha
*
(
v1
&
va
)
*
(
delP
&
va
);
c
=
sqrCosAlpha
*
((
delP
-
(
delP
&
va
)
*
va
)
&
(
delP
-
(
delP
&
va
)
*
va
))
-
sqrSinAlpha
*
sqr
(
delP
&
va
);
}
const
scalar
disc
=
b
*
b
-
4
.
0
*
a
*
c
;
scalar
t1
=
-
VGREAT
;
...
...
@@ -795,7 +815,7 @@ void Foam::searchableCone::findLine
}
if
(
innerRadius1_
>
0
.
0
&&
innerRadius2_
>
0
.
0
)
if
(
innerRadius1_
>
0
.
0
||
innerRadius2_
>
0
.
0
)
{
IOobject
io
(
*
this
);
io
.
rename
(
name
()
+
"Inner"
);
...
...
@@ -875,7 +895,7 @@ void Foam::searchableCone::findLineAny
info
[
i
]
=
b
;
}
}
if
(
innerRadius1_
>
0
.
0
&&
innerRadius2_
>
0
.
0
)
if
(
innerRadius1_
>
0
.
0
||
innerRadius2_
>
0
.
0
)
{
IOobject
io
(
*
this
);
io
.
rename
(
name
()
+
"Inner"
);
...
...
@@ -966,7 +986,7 @@ void Foam::searchableCone::findLineAll
}
}
if
(
innerRadius1_
>
0
.
0
&&
innerRadius2_
>
0
.
0
)
if
(
innerRadius1_
>
0
.
0
||
innerRadius2_
>
0
.
0
)
{
IOobject
io
(
*
this
);
io
.
rename
(
name
()
+
"Inner"
);
...
...
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