Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VTK Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
VTK
VTK Examples
Commits
26931fa0
Commit
26931fa0
authored
4 years ago
by
Andrew Maclean
Browse files
Options
Downloads
Patches
Plain Diff
SYNC: Files modified in the repo.
Former-commit-id:
417965c1
parent
cf9c0350
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
site/Instructions/Guidelines/index.html
+43
-2
43 additions, 2 deletions
site/Instructions/Guidelines/index.html
src/Instructions/Guidelines.md
+30
-30
30 additions, 30 deletions
src/Instructions/Guidelines.md
with
73 additions
and
32 deletions
site/Instructions/Guidelines/index.html
+
43
−
2
View file @
26931fa0
This diff is collapsed.
Click to expand it.
src/Instructions/Guidelines.md
+
30
−
30
View file @
26931fa0
...
...
@@ -18,7 +18,7 @@ All examples should follow the VTK programming style and there should be a singl
Example:
``` c++
```
c++
if
(
this
->
Locator
==
locator
)
{
return
;
...
...
@@ -28,19 +28,19 @@ All examples should follow the VTK programming style and there should be a singl
p1
=
this
->
Source
->
GetPoint
(
i
);
[...]
}
```
```
*
Where appropriate, explicitly use the std:: namespace:
```c ++
```
c ++
std::cout << "Print something" << std::endl;
```
```
rather than
``` c++
```
c++
cout
<<
"Print something"
<<
endl
;
```
```
*
All includes from the toolkit should use
<>
notation. This follows C++ programming conventions.
...
...
@@ -48,55 +48,55 @@ All examples should follow the VTK programming style and there should be a singl
*
The main program must have the following signature:
``` c++
```
c++
int
main
(
int
argc
,
char
*
argv
[])
```
```
or, if argc and argv are not referenced in the code,
``` c++
```
c++
int
main
(
int
,
char
*
[])
```
```
*
If arguments are required, a check similar to the following should be made at the start of the main program.
``` c++
```
c++
if
(
argc
!=
3
)
{
std
::
cerr
<<
"Usage: "
<<
argv
[
0
]
<<
"Alpha InputFile OutputFile"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
```
```
*
An example should
**never call exit()**
. If the main program executes successfully, it should
``` c++
```
c++
return
EXIT_SUCCESS
;
```
```
otherwise
``` c++
```
c++
return
EXIT_FAILURE
;
```
```
*
The use of SmartPointers is preferred in VTK examples.
``` c++
```
c++
vtkSmartPointer
<
vtkCutter
>
cutter
=
vtkSmartPointer
<
vtkCutter
>::
New
();
```
```
or
``` c++
```
c++
vtkNew
<
vtkCutter
>
cutter
;
```
```
is preferred over
``` c++
```
c++
vtkCutter
*
cutter
=
vtkCutter
::
New
();
```
```
*
When building pipelines, the new
`SetInputConnection()`
,
`GetOutputPort()`
methods should be used instead of
`SetInput()`
,
`GetOutput()`
...
...
@@ -108,17 +108,17 @@ All examples should follow the VTK programming style and there should be a singl
For example, this program
``` c++
```
c++
Delaunay3DAlpha
Alpha
InputPolydataFileName
(.
vtp
)
OutputUnstructuredGridFilename
(.
vtu
)
```
```
would use the arguments in this manner
``` c++
```
c++
reader
->
SetFileName
(
argv
[
2
]);
delaunay3D
->
SetAlpha
(
atof
(
argv
[
1
]));
writer
->
SetFileName
(
argv
[
3
]
);
```
```
*
Always provide a background for the renderers. Avoid setting the background to white.
...
...
@@ -126,20 +126,20 @@ All examples should follow the VTK programming style and there should be a singl
For example,
``` c++
```
c++
#include
<vtkNamedColors.h>
vtkSmartPointer
<
vtkNamedColors
>
namedColors
=
vtkSmartPointer
<
vtkNamedColors
>::
New
();
renderer
->
SetBackground
(
namedColors
->
GetColor3d
(
"Khaki"
).
GetData
());
```
```
is preferred over
``` c++
```
c++
renderer
->
SetBackground
(
0.9412
,
0.9020
,
0.5490
);
```
```
*
Use admonitions to warn/cite/info, etc.
[
Here is a summary of admonitions
](
__SITE__/Instructions/ForAdministrators/#admonition
)
.
...
...
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