Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
0ec53b7f
Commit
0ec53b7f
authored
Apr 07, 2004
by
Kenneth Moreland
Browse files
Corrections for triangulation.
parent
b9ac0bc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Common/vtkHexahedron.cxx
View file @
0ec53b7f
...
...
@@ -24,7 +24,7 @@
#include
"vtkPoints.h"
#include
"vtkQuad.h"
vtkCxxRevisionMacro
(
vtkHexahedron
,
"1.9
1
"
);
vtkCxxRevisionMacro
(
vtkHexahedron
,
"1.9
2
"
);
vtkStandardNewMacro
(
vtkHexahedron
);
static
const
double
VTK_DIVERGED
=
1.e6
;
...
...
@@ -549,28 +549,28 @@ int vtkHexahedron::Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)
// is necessary to insure compatible voxel triangulations.
if
(
(
index
%
2
)
)
{
p
[
0
]
=
0
;
p
[
1
]
=
1
;
p
[
2
]
=
4
;
p
[
3
]
=
3
;
p
[
0
]
=
0
;
p
[
1
]
=
1
;
p
[
2
]
=
3
;
p
[
3
]
=
4
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
pts
->
InsertNextPoint
(
this
->
Points
->
GetPoint
(
p
[
i
]));
}
p
[
0
]
=
1
;
p
[
1
]
=
4
;
p
[
2
]
=
6
;
p
[
3
]
=
5
;
p
[
0
]
=
1
;
p
[
1
]
=
4
;
p
[
2
]
=
5
;
p
[
3
]
=
6
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
pts
->
InsertNextPoint
(
this
->
Points
->
GetPoint
(
p
[
i
]));
}
p
[
0
]
=
1
;
p
[
1
]
=
4
;
p
[
2
]
=
3
;
p
[
3
]
=
6
;
p
[
0
]
=
1
;
p
[
1
]
=
4
;
p
[
2
]
=
6
;
p
[
3
]
=
3
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
pts
->
InsertNextPoint
(
this
->
Points
->
GetPoint
(
p
[
i
]));
}
p
[
0
]
=
1
;
p
[
1
]
=
3
;
p
[
2
]
=
2
;
p
[
3
]
=
6
;
p
[
0
]
=
1
;
p
[
1
]
=
3
;
p
[
2
]
=
6
;
p
[
3
]
=
2
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
...
...
@@ -586,21 +586,21 @@ int vtkHexahedron::Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)
}
else
{
p
[
0
]
=
2
;
p
[
1
]
=
1
;
p
[
2
]
=
0
;
p
[
3
]
=
5
;
p
[
0
]
=
2
;
p
[
1
]
=
1
;
p
[
2
]
=
5
;
p
[
3
]
=
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
pts
->
InsertNextPoint
(
this
->
Points
->
GetPoint
(
p
[
i
]));
}
p
[
0
]
=
0
;
p
[
1
]
=
2
;
p
[
2
]
=
7
;
p
[
3
]
=
3
;
p
[
0
]
=
0
;
p
[
1
]
=
2
;
p
[
2
]
=
3
;
p
[
3
]
=
7
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
pts
->
InsertNextPoint
(
this
->
Points
->
GetPoint
(
p
[
i
]));
}
p
[
0
]
=
2
;
p
[
1
]
=
5
;
p
[
2
]
=
7
;
p
[
3
]
=
6
;
p
[
0
]
=
2
;
p
[
1
]
=
5
;
p
[
2
]
=
6
;
p
[
3
]
=
7
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertNextId
(
this
->
PointIds
->
GetId
(
p
[
i
]));
...
...
Common/vtkPyramid.cxx
View file @
0ec53b7f
...
...
@@ -25,7 +25,7 @@
#include
"vtkTriangle.h"
#include
"vtkUnstructuredGrid.h"
vtkCxxRevisionMacro
(
vtkPyramid
,
"1.3
6
"
);
vtkCxxRevisionMacro
(
vtkPyramid
,
"1.3
7
"
);
vtkStandardNewMacro
(
vtkPyramid
);
static
const
double
VTK_DIVERGED
=
1.e6
;
...
...
@@ -550,16 +550,53 @@ int vtkPyramid::IntersectWithLine(double p1[3], double p2[3], double tol, double
//----------------------------------------------------------------------------
int
vtkPyramid
::
Triangulate
(
int
vtkNotUsed
(
index
),
vtkIdList
*
ptIds
,
vtkPoints
*
pts
)
{
int
p
[
4
],
i
;
ptIds
->
Reset
();
pts
->
Reset
();
for
(
int
i
=
0
;
i
<
4
;
i
++
)
// The base of the pyramid must be split into two triangles. There are two
// ways to do this (across either diagonal). Pick the shorter diagonal.
double
base_points
[
4
][
3
];
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertId
(
i
,
this
->
PointIds
->
GetId
(
i
));
pts
->
InsertPoint
(
i
,
this
->
Points
->
GetPoint
(
i
));
this
->
Points
->
GetPoint
(
i
,
base_points
[
i
]);
}
double
diagonal1
,
diagonal2
;
diagonal1
=
vtkMath
::
Distance2BetweenPoints
(
base_points
[
0
],
base_points
[
2
]);
diagonal2
=
vtkMath
::
Distance2BetweenPoints
(
base_points
[
1
],
base_points
[
3
]);
return
1
;
if
(
diagonal1
<
diagonal2
)
{
p
[
0
]
=
0
;
p
[
1
]
=
1
;
p
[
2
]
=
2
;
p
[
3
]
=
4
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertId
(
i
,
this
->
PointIds
->
GetId
(
i
));
pts
->
InsertPoint
(
i
,
this
->
Points
->
GetPoint
(
i
));
}
p
[
0
]
=
0
;
p
[
1
]
=
2
;
p
[
2
]
=
3
;
p
[
3
]
=
4
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertId
(
i
,
this
->
PointIds
->
GetId
(
i
));
pts
->
InsertPoint
(
i
,
this
->
Points
->
GetPoint
(
i
));
}
}
else
{
p
[
0
]
=
0
;
p
[
1
]
=
1
;
p
[
2
]
=
3
;
p
[
3
]
=
4
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertId
(
i
,
this
->
PointIds
->
GetId
(
i
));
pts
->
InsertPoint
(
i
,
this
->
Points
->
GetPoint
(
i
));
}
p
[
0
]
=
1
;
p
[
1
]
=
2
;
p
[
2
]
=
3
;
p
[
3
]
=
4
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ptIds
->
InsertId
(
i
,
this
->
PointIds
->
GetId
(
i
));
pts
->
InsertPoint
(
i
,
this
->
Points
->
GetPoint
(
i
));
}
}
return
!
(
diagonal1
==
diagonal2
);
}
//----------------------------------------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment