Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK
VTK
Commits
748e4740
Commit
748e4740
authored
Mar 03, 1994
by
Will Schroeder
Browse files
ENH: Preparing for advent of cells.
parent
781b3c06
Changes
14
Hide whitespace changes
Inline
Side-by-side
include/CellList.hh
View file @
748e4740
...
...
@@ -22,7 +22,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Object.hh"
struct
vlCell
{
short
type
;
unsigned
char
type
;
int
loc
;
};
...
...
@@ -33,10 +33,10 @@ public:
~
vlCellList
();
char
*
GetClassName
()
{
return
"vlCellList"
;};
vlCell
&
GetCell
(
const
int
id
)
{
return
this
->
Array
[
id
];};
short
GetCellType
(
const
int
id
)
{
return
this
->
Array
[
id
].
type
;};
unsigned
char
GetCellType
(
const
int
id
)
{
return
this
->
Array
[
id
].
type
;};
int
GetCellLoc
(
const
int
id
)
{
return
this
->
Array
[
id
].
loc
;};
void
InsertCell
(
const
int
id
,
const
short
type
,
const
int
loc
);
int
InsertNextCell
(
const
short
type
,
const
int
pos
);
void
InsertCell
(
const
int
id
,
const
unsigned
char
type
,
const
int
loc
);
int
InsertNextCell
(
const
unsigned
char
type
,
const
int
pos
);
void
Squeeze
();
void
Reset
();
...
...
include/DS2SPtsF.hh
View file @
748e4740
...
...
@@ -16,20 +16,20 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
//
Poly
ToStructuredPointsFilter are filters that take
Poly
Data in and
//
DataSet
ToStructuredPointsFilter are filters that take Data
Sets
in and
// generate StructuredPoints data
//
#ifndef __vl
Poly
ToStructuredPointsFilter_h
#define __vl
Poly
ToStructuredPointsFilter_h
#ifndef __vl
DataSet
ToStructuredPointsFilter_h
#define __vl
DataSet
ToStructuredPointsFilter_h
#include "
Poly
F.hh"
#include "
DataSet
F.hh"
#include "SPoints.hh"
class
vl
Poly
ToStructuredPointsFilter
:
public
vlStructuredPoints
,
public
vl
Poly
Filter
class
vl
DataSet
ToStructuredPointsFilter
:
public
vlStructuredPoints
,
public
vl
DataSet
Filter
{
public:
void
Update
();
char
*
GetClassName
()
{
return
"vl
Poly
ToStructuredPointsFilter"
;};
char
*
GetClassName
()
{
return
"vl
DataSet
ToStructuredPointsFilter"
;};
void
PrintSelf
(
ostream
&
os
,
vlIndent
indent
);
};
...
...
include/ImpMod.hh
View file @
748e4740
...
...
@@ -21,9 +21,9 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlImplicitModeller_h
#define __vlImplicitModeller_h
#include "
P
2SPtsF.hh"
#include "
DS
2SPtsF.hh"
class
vlImplicitModeller
:
public
vl
Poly
ToStructuredPointsFilter
class
vlImplicitModeller
:
public
vl
DataSet
ToStructuredPointsFilter
{
public:
vlImplicitModeller
();
...
...
include/Line.hh
View file @
748e4740
...
...
@@ -21,20 +21,15 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlLine_h
#define __vlLine_h
#include "Object.hh"
#include "Points.hh"
#include "CellArr.hh"
#include "FNormals.hh"
#include "Cell.hh"
#define MAX_RESOLUTION MAX_VERTS
class
vlLine
:
public
vlObject
class
vlLine
:
public
vlCell
{
public:
vlLine
()
{};
char
*
GetClassName
()
{
return
"vlLine"
;};
int
GenerateNormals
(
vlPoints
*
,
vlCellArray
*
,
vlFloatNormals
*
);
float
DistanceToPoint
(
float
*
x
);
};
...
...
include/LinkList.hh
View file @
748e4740
...
...
@@ -29,14 +29,16 @@ struct vlLink {
class
vlLinkList
:
public
vlObject
{
public:
vlLinkList
()
:
Array
(
0
),
Size
(
0
),
MaxId
(
-
1
),
Extend
(
1000
)
{};
vlLinkList
(
const
int
sz
,
const
int
ext
);
vlLinkList
(
const
int
sz
,
const
int
ext
=
1000
);
~
vlLinkList
();
char
*
GetClassName
()
{
return
"vlLinkList"
;};
vlLink
&
GetLink
(
const
int
id
)
{
return
this
->
Array
[
id
];};
unsigned
short
GetNcells
(
const
int
id
)
{
return
this
->
Array
[
id
].
ncells
;};
int
*
GetCells
(
const
int
id
)
{
return
this
->
Array
[
id
].
cells
;};
void
InsertLink
(
const
int
id
,
const
unsigned
short
ncells
,
int
*
cells
);
int
InsertNextLink
(
const
unsigned
short
ncells
,
int
*
cells
);
void
IncrementLinkCount
(
const
int
id
)
{
this
->
Array
[
id
].
ncells
++
;};
void
AllocateLinks
();
void
InsertCellReference
(
const
int
id
,
const
int
pos
,
const
int
cellId
)
{
this
->
Array
[
id
].
cells
[
pos
]
=
cellId
;};
void
Squeeze
();
void
Reset
();
...
...
include/PolyData.hh
View file @
748e4740
...
...
@@ -23,8 +23,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "DataSet.hh"
#include "FPoints.hh"
#include "CellArr.hh"
#include "CellList.hh"
#include "LinkList.hh"
#define MAX_VERTS MAX_CELL_SIZE
...
...
@@ -77,13 +75,8 @@ private:
vlCellArray
*
Lines
;
vlCellArray
*
Polys
;
vlCellArray
*
Strips
;
vlCellList
Cells
;
vlLinkList
Links
;
// dummy static member below used as a trick to simplify traversal
static
vlCellArray
*
Dummy
;
void
BuildCells
();
void
BuildLinks
();
};
#endif
...
...
include/Polygon.hh
View file @
748e4740
...
...
@@ -21,12 +21,12 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlPolygon_h
#define __vlPolygon_h
#include "
Object
.hh"
#include "
Cell
.hh"
#include "Points.hh"
#define MAX_RESOLUTION MAX_VERTS
class
vlPolygon
:
public
vl
Object
class
vlPolygon
:
public
vl
Cell
{
public:
vlPolygon
()
{};
...
...
@@ -35,6 +35,7 @@ public:
void
ComputeNormal
(
vlPoints
*
p
,
int
numPts
,
int
*
pts
,
float
*
n
);
void
ComputeNormal
(
float
*
v1
,
float
*
v2
,
float
*
v3
,
float
*
n
);
float
DistanceToPoint
(
float
*
x
);
};
#endif
...
...
src/CellList.cc
View file @
748e4740
...
...
@@ -32,7 +32,7 @@ vlCellList::~vlCellList()
//
// Add a cell to structure
//
void
vlCellList
::
InsertCell
(
const
int
id
,
const
short
type
,
const
int
loc
)
void
vlCellList
::
InsertCell
(
const
int
id
,
const
unsigned
char
type
,
const
int
loc
)
{
vlCell
*
cell
;
...
...
@@ -46,7 +46,7 @@ void vlCellList::InsertCell(const int id, const short type, const int loc)
return
;
}
int
vlCellList
::
InsertNextCell
(
const
short
type
,
const
int
loc
)
int
vlCellList
::
InsertNextCell
(
const
unsigned
char
type
,
const
int
loc
)
{
this
->
InsertCell
(
++
this
->
MaxId
,
type
,
loc
);
return
this
->
MaxId
;
...
...
src/DS2SPtsF.cc
View file @
748e4740
...
...
@@ -15,21 +15,21 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include "
P
2SPtsF.hh"
#include "
DS
2SPtsF.hh"
void
vl
Poly
ToStructuredPointsFilter
::
Update
()
void
vl
DataSet
ToStructuredPointsFilter
::
Update
()
{
vl
Poly
Filter
::
Update
();
vl
DataSet
Filter
::
Update
();
}
void
vl
Poly
ToStructuredPointsFilter
::
PrintSelf
(
ostream
&
os
,
vlIndent
indent
)
void
vl
DataSet
ToStructuredPointsFilter
::
PrintSelf
(
ostream
&
os
,
vlIndent
indent
)
{
if
(
this
->
ShouldIPrint
(
vl
Poly
ToStructuredPointsFilter
::
GetClassName
()))
if
(
this
->
ShouldIPrint
(
vl
DataSet
ToStructuredPointsFilter
::
GetClassName
()))
{
this
->
PrintWatchOn
();
// watch for multiple inheritance
vlStructuredPoints
::
PrintSelf
(
os
,
indent
);
vl
Poly
Filter
::
PrintSelf
(
os
,
indent
);
vl
DataSet
Filter
::
PrintSelf
(
os
,
indent
);
this
->
PrintWatchOff
();
// stop worrying about it now
}
...
...
src/ImpMod.cc
View file @
748e4740
...
...
@@ -37,7 +37,7 @@ void vlImplicitModeller::PrintSelf(ostream& os, vlIndent indent)
{
if
(
this
->
ShouldIPrint
(
vlImplicitModeller
::
GetClassName
()))
{
vl
Poly
ToStructuredPointsFilter
::
PrintSelf
(
os
,
indent
);
vl
DataSet
ToStructuredPointsFilter
::
PrintSelf
(
os
,
indent
);
os
<<
indent
<<
"Maximum Distance: "
<<
this
->
MaximumDistance
<<
"
\n
"
;
os
<<
indent
<<
"ModelBounds:
\n
"
;
...
...
src/Line.cc
View file @
748e4740
...
...
@@ -16,70 +16,9 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include "Line.hh"
#include "vlMath.hh"
in
t
vlLine
::
GenerateNormals
(
vlPoints
*
pts
,
vlCellArray
*
lines
,
vlFloatNormals
*
normals
)
floa
t
vlLine
::
DistanceToPoint
(
float
*
x
)
{
int
npts
,
*
linePts
;
float
s
[
3
],
q
[
3
],
norm
[
3
],
*
n
;
float
*
p1
,
*
p2
;
float
s_norm
,
n_norm
,
q_norm
;
int
i
,
j
;
vlMath
math
;
//
// Loop over all lines
//
for
(
lines
->
InitTraversal
();
lines
->
GetNextCell
(
npts
,
linePts
);
)
{
//
// Determine initial starting normal
//
if
(
npts
<
2
)
return
0
;
p1
=
pts
->
GetPoint
(
linePts
[
0
]);
p2
=
pts
->
GetPoint
(
linePts
[
1
]);
for
(
i
=
0
;
i
<
3
;
i
++
)
s
[
i
]
=
p2
[
i
]
-
p1
[
i
];
if
(
(
s_norm
=
math
.
Norm
(
s
))
==
0.0
)
return
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
s
[
i
]
/=
s_norm
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
if
(
s
[
i
]
!=
0.0
)
{
norm
[(
i
+
2
)
%
3
]
=
0.0
;
norm
[(
i
+
1
)
%
3
]
=
1.0
;
norm
[
i
]
=
-
s
[(
i
+
1
)
%
3
]
/
s
[
i
];
break
;
}
}
n_norm
=
math
.
Norm
(
norm
);
for
(
i
=
0
;
i
<
3
;
i
++
)
norm
[
i
]
/=
n_norm
;
normals
->
InsertNormal
(
0
,
norm
);
//
// Generate normals for new point by projecting previous normal
//
for
(
j
=
1
;
j
<
npts
;
j
++
)
{
p1
=
pts
->
GetPoint
(
linePts
[
j
-
1
]);
p2
=
pts
->
GetPoint
(
linePts
[
j
]);
for
(
i
=
0
;
i
<
3
;
i
++
)
s
[
i
]
=
p2
[
i
]
-
p1
[
i
];
if
(
(
s_norm
=
math
.
Norm
(
s
))
==
0.0
)
return
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
s
[
i
]
/=
s_norm
;
n
=
normals
->
GetNormal
(
j
-
1
);
math
.
Cross
(
s
,
n
,
q
);
if
(
(
q_norm
=
math
.
Norm
(
q
))
==
0.0
)
return
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
q
[
i
]
/=
q_norm
;
math
.
Cross
(
q
,
s
,
norm
);
n_norm
=
math
.
Norm
(
norm
);
for
(
i
=
0
;
i
<
3
;
i
++
)
norm
[
i
]
/=
n_norm
;
normals
->
InsertNormal
(
j
,
norm
);
}
}
return
1
;
return
1.0
;
}
src/LinkList.cc
View file @
748e4740
...
...
@@ -13,7 +13,6 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <iostream.h>
#include "LinkList.hh"
vlLinkList
::
vlLinkList
(
const
int
sz
,
const
int
ext
)
...
...
@@ -32,24 +31,12 @@ vlLinkList::~vlLinkList()
//
// Add a link to structure
//
void
vlLinkList
::
InsertLink
(
const
int
id
,
const
unsigned
short
ncells
,
int
*
cells
)
void
vlLinkList
::
AllocateLinks
(
)
{
vlLink
*
link
;
if
(
id
>=
this
->
Size
)
this
->
Resize
(
id
);
if
(
id
>
this
->
MaxId
)
this
->
MaxId
=
id
;
link
=
this
->
Array
+
id
;
link
->
ncells
=
ncells
;
for
(
unsigned
short
i
=
0
;
i
<
ncells
;
i
++
)
link
->
cells
[
i
]
=
cells
[
i
];
return
;
}
int
vlLinkList
::
InsertNextLink
(
const
unsigned
short
ncells
,
int
*
cells
)
{
this
->
InsertLink
(
++
this
->
MaxId
,
ncells
,
cells
);
return
this
->
MaxId
;
for
(
int
i
=
0
;
i
<=
this
->
MaxId
;
i
++
)
{
this
->
Array
[
i
].
cells
=
new
int
[
this
->
Array
[
i
].
ncells
];
}
}
void
vlLinkList
::
Squeeze
()
...
...
src/Polygon.cc
View file @
748e4740
...
...
@@ -79,3 +79,9 @@ void vlPolygon::ComputeNormal(float *v1, float *v2, float *v3, float *n)
n
[
2
]
/=
length
;
}
}
float
vlPolygon
::
DistanceToPoint
(
float
*
x
)
{
return
1.0
;
}
src/RibbonF.cc
View file @
748e4740
...
...
@@ -19,7 +19,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "RibbonF.hh"
#include "FPoints.hh"
#include "FNormals.hh"
#include "Line.hh"
#include "
Poly
Line.hh"
vlRibbonFilter
::
vlRibbonFilter
()
{
...
...
@@ -63,8 +63,8 @@ void vlRibbonFilter::Execute()
if
(
!
(
inNormals
=
pd
->
GetNormals
())
)
{
vlPolyLine
lineNormalGenerator
;
deleteNormals
=
1
;
vlLine
lineNormalGenerator
;
inNormals
=
new
vlFloatNormals
(
inPts
->
NumberOfPoints
());
if
(
!
lineNormalGenerator
.
GenerateNormals
(
inPts
,
inLines
,(
vlFloatNormals
*
)
inNormals
)
)
{
...
...
Write
Preview
Supports
Markdown
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