Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
3e49bb14
Commit
3e49bb14
authored
Oct 11, 2010
by
mattijs
Browse files
BUG: plane : fix 3-plane intersection
parent
35ae737f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
View file @
3e49bb14
...
...
@@ -272,10 +272,10 @@ const Foam::point& Foam::plane::refPoint() const
}
// Return coeffic
c
ients for plane equation: ax + by + cz + d = 0
Foam
::
scalar
List
Foam
::
plane
::
planeCoeffs
()
const
// Return coefficients for plane equation: ax + by + cz + d = 0
Foam
::
FixedList
<
Foam
::
scalar
,
4
>
Foam
::
plane
::
planeCoeffs
()
const
{
scalar
List
C
(
4
);
FixedList
<
scalar
,
4
>
C
(
4
);
scalar
magX
=
mag
(
unitVector_
.
x
());
scalar
magY
=
mag
(
unitVector_
.
y
());
...
...
@@ -291,8 +291,8 @@ Foam::scalarList Foam::plane::planeCoeffs() const
}
else
{
C
[
0
]
=
0
;
C
[
1
]
=
0
;
C
[
0
]
=
unitVector_
.
x
()
/
unitVector_
.
z
()
;
C
[
1
]
=
unitVector_
.
y
()
/
unitVector_
.
z
()
;
C
[
2
]
=
1
;
}
}
...
...
@@ -300,14 +300,14 @@ Foam::scalarList Foam::plane::planeCoeffs() const
{
if
(
magY
>
magZ
)
{
C
[
0
]
=
0
;
C
[
0
]
=
unitVector_
.
x
()
/
unitVector_
.
y
()
;
C
[
1
]
=
1
;
C
[
2
]
=
unitVector_
.
z
()
/
unitVector_
.
y
();
}
else
{
C
[
0
]
=
0
;
C
[
1
]
=
0
;
C
[
0
]
=
unitVector_
.
x
()
/
unitVector_
.
z
()
;
C
[
1
]
=
unitVector_
.
y
()
/
unitVector_
.
z
()
;
C
[
2
]
=
1
;
}
}
...
...
@@ -422,19 +422,18 @@ Foam::point Foam::plane::planePlaneIntersect
const
plane
&
plane3
)
const
{
List
<
scalarList
>
pcs
(
3
);
pcs
[
0
]
=
planeCoeffs
();
pcs
[
1
]
=
plane2
.
planeCoeffs
();
pcs
[
2
]
=
plane3
.
planeCoeffs
();
FixedList
<
scalar
,
4
>
coeffs1
(
planeCoeffs
());
FixedList
<
scalar
,
4
>
coeffs2
(
plane2
.
planeCoeffs
());
FixedList
<
scalar
,
4
>
coeffs3
(
plane3
.
planeCoeffs
());
tensor
a
(
pcs
[
0
][
0
],
pcs
[
0
][
1
],
pcs
[
0
]
[
2
],
pcs
[
1
][
0
],
pcs
[
1
][
1
],
pcs
[
1
]
[
2
],
pcs
[
2
][
0
],
pcs
[
2
][
1
],
pcs
[
2
]
[
2
]
coeffs1
[
0
],
coeffs1
[
1
],
coeffs1
[
2
],
coeffs2
[
0
],
coeffs2
[
1
],
coeffs2
[
2
],
coeffs3
[
0
],
coeffs3
[
1
],
coeffs3
[
2
]
);
vector
b
(
pcs
[
0
][
3
],
pcs
[
1
][
3
],
pcs
[
2
]
[
3
]);
vector
b
(
coeffs1
[
3
],
coeffs2
[
3
],
coeffs3
[
3
]);
return
(
inv
(
a
)
&
(
-
b
));
}
...
...
src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
View file @
3e49bb14
...
...
@@ -149,7 +149,7 @@ public:
//- Return coefficients for the
// plane equation: ax + by + cz + d = 0
scalar
List
planeCoeffs
()
const
;
FixedList
<
scalar
,
4
>
planeCoeffs
()
const
;
//- Return nearest point in the plane for the given point
point
nearestPoint
(
const
point
&
p
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment