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
Andrew Bauer
VTK
Commits
e36145bc
Commit
e36145bc
authored
Mar 08, 1995
by
Will Schroeder
Browse files
ENH: Compute gradients not normals (since not normalized).
parent
05a01e2b
Changes
7
Hide whitespace changes
Inline
Side-by-side
include/ImpBool.hh
View file @
e36145bc
...
...
@@ -47,7 +47,7 @@ public:
// ImplicitFunction interface
float
Evaluate
(
float
x
,
float
y
,
float
z
);
void
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
]);
void
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
g
[
3
]);
// Override modified time retrieval because of object dependencies.
unsigned
long
int
GetMTime
();
...
...
include/ImpFunc.hh
View file @
e36145bc
...
...
@@ -33,8 +33,8 @@ public:
virtual
float
Evaluate
(
float
x
,
float
y
,
float
z
)
=
0
;
// Description:
// Evaluate function
normal
at position x-y-z and pass back vector.
virtual
void
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
])
=
0
;
// Evaluate function
gradient
at position x-y-z and pass back vector.
virtual
void
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
g
[
3
])
=
0
;
};
...
...
include/Plane.hh
View file @
e36145bc
...
...
@@ -39,7 +39,7 @@ public:
// ImplicitFunction interface
float
Evaluate
(
float
x
,
float
y
,
float
z
);
float
Evaluate
(
float
normal
[
3
],
float
origin
[
3
],
float
x
[
3
]);
void
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
]);
void
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
g
[
3
]);
vlSetVector3Macro
(
Normal
,
float
);
vlGetVectorMacro
(
Normal
,
float
,
3
);
...
...
include/Sphere.hh
View file @
e36145bc
...
...
@@ -15,7 +15,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
// .NAME vlSphere - implicit function for a sphere
// .SECTION Description
// vlSphere computes the implicit function and
surface normal
for a sphere.
// vlSphere computes the implicit function and
/or gradient
for a sphere.
// vlSphere is a concrete implementation of vlImplicitFunction.
#ifndef __vlSphere_h
...
...
@@ -32,7 +32,7 @@ public:
// ImplicitFunction interface
float
Evaluate
(
float
x
,
float
y
,
float
z
);
void
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
]);
void
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
n
[
3
]);
vlSetMacro
(
Radius
,
float
);
vlGetMacro
(
Radius
,
float
);
...
...
src/ImpBool.cc
View file @
e36145bc
...
...
@@ -108,8 +108,8 @@ float vlImplicitBoolean::Evaluate(float x, float y, float z)
}
// Description
// Evaluate
sphere normal
.
void
vlImplicitBoolean
::
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
])
// Evaluate
gradient of boolean combination
.
void
vlImplicitBoolean
::
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
g
[
3
])
{
float
value
,
v
;
vlImplicitFunction
*
f
;
...
...
@@ -122,7 +122,7 @@ void vlImplicitBoolean::EvaluateNormal(float x, float y, float z, float n[3])
if
(
(
v
=
f
->
Evaluate
(
x
,
y
,
z
))
<
value
)
{
value
=
v
;
f
->
Evaluate
Normal
(
x
,
y
,
z
,
n
);
f
->
Evaluate
Gradient
(
x
,
y
,
z
,
g
);
}
}
}
...
...
@@ -135,21 +135,21 @@ void vlImplicitBoolean::EvaluateNormal(float x, float y, float z, float n[3])
if
(
(
v
=
f
->
Evaluate
(
x
,
y
,
z
))
>
value
)
{
value
=
v
;
f
->
Evaluate
Normal
(
x
,
y
,
z
,
n
);
f
->
Evaluate
Gradient
(
x
,
y
,
z
,
g
);
}
}
}
else
//difference
{
float
n
Temp
[
3
];
float
g
Temp
[
3
];
vlImplicitFunction
*
firstF
;
this
->
FunctionList
.
InitTraversal
();
if
(
(
firstF
=
this
->
FunctionList
.
GetNextItem
())
!=
NULL
)
{
value
=
firstF
->
Evaluate
(
x
,
y
,
z
);
firstF
->
Evaluate
Normal
(
x
,
y
,
z
,
n
Temp
);
n
[
0
]
=
-
1.0
*
n
Temp
[
0
];
n
[
1
]
=
-
1.0
*
n
Temp
[
1
];
n
[
2
]
=
-
1.0
*
n
Temp
[
2
];
firstF
->
Evaluate
Gradient
(
x
,
y
,
z
,
g
Temp
);
g
[
0
]
=
-
1.0
*
g
Temp
[
0
];
g
[
1
]
=
-
1.0
*
g
Temp
[
1
];
g
[
2
]
=
-
1.0
*
g
Temp
[
2
];
}
for
(
this
->
FunctionList
.
InitTraversal
();
...
...
@@ -160,8 +160,8 @@ void vlImplicitBoolean::EvaluateNormal(float x, float y, float z, float n[3])
if
(
(
v
=
(
-
1.0
)
*
f
->
Evaluate
(
x
,
y
,
z
))
>
value
)
{
value
=
v
;
f
->
Evaluate
Normal
(
x
,
y
,
z
,
n
Temp
);
n
[
0
]
=
-
1.0
*
n
Temp
[
0
];
n
[
1
]
=
-
1.0
*
n
Temp
[
1
];
n
[
2
]
=
-
1.0
*
n
Temp
[
2
];
f
->
Evaluate
Gradient
(
x
,
y
,
z
,
g
Temp
);
g
[
0
]
=
-
1.0
*
g
Temp
[
0
];
g
[
1
]
=
-
1.0
*
g
Temp
[
1
];
g
[
2
]
=
-
1.0
*
g
Temp
[
2
];
}
}
}
...
...
src/Plane.cc
View file @
e36145bc
...
...
@@ -55,8 +55,8 @@ float vlPlane::Evaluate(float x, float y, float z)
}
// Description
// Evaluate
plane normal
at point (x,y,z).
void
vlPlane
::
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
])
// Evaluate
function gradient
at point (x,y,z).
void
vlPlane
::
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
n
[
3
])
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
n
[
i
]
=
this
->
Normal
[
i
];
}
...
...
src/Sphere.cc
View file @
e36145bc
...
...
@@ -37,8 +37,8 @@ float vlSphere::Evaluate(float x, float y, float z)
}
// Description
// Evaluate sphere
normal
.
void
vlSphere
::
Evaluate
Normal
(
float
x
,
float
y
,
float
z
,
float
n
[
3
])
// Evaluate sphere
gradient
.
void
vlSphere
::
Evaluate
Gradient
(
float
x
,
float
y
,
float
z
,
float
n
[
3
])
{
n
[
0
]
=
2.0
*
(
x
-
this
->
Center
[
0
]);
n
[
1
]
=
2.0
*
(
y
-
this
->
Center
[
1
]);
...
...
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