Closed vikasTmz closed 7 years ago
cube.cao
file:
$ more cube.cao
V1
# 3D points
8 # Number of points (here 8 cube corners)
0.000 0.000 0.000 # Point with index 0
-0.084 0.000 0.000
-0.084 0.084 0.000
0.000 0.084 0.000
0.000 0.000 0.084
-0.084 0.000 0.084
-0.084 0.084 0.084
0.000 0.084 0.084 # point with index 7
# 3D lines
0 # No 3D lines
# 3D faces from lines
0 # No 3D faces from lines
# 3D faces from points
6 # 6 faces to describe the cube
4 0 4 5 1 # Face with index 0 defined by 3D point 0, 4, 5 and 1
4 1 5 6 2
4 6 7 3 2
4 3 7 4 0
4 0 1 2 3
4 7 6 5 4 # Face with index 5
# 3D cylinders
0
# 3D circle
0 # No 3D circle
cube_and_cylinder.cao
file, only the cylinder is imported
$ more cube_and_cylinder.cao
V1
# 3D points
10 # Number of points
0.000 0.000 0.000 # Point with index 0
-0.084 0.000 0.000
-0.084 0.084 0.000
0.000 0.084 0.000
0.000 0.000 0.084
-0.084 0.000 0.084
-0.084 0.084 0.084
0.000 0.084 0.084
-0.170 -0.030 0.000 # Point with index 8 used to define the cylinder
-0.170 -0.030 0.250 # Point with index 9 used to define the cylinder
# 3D lines
0 # No 3D lines
# 3D faces from lines
0 # No 3D faces from lines
# 3D faces from points
6 # 6 faces to describe the cube
4 0 4 5 1 # Face with index 0 defined by 3D point 0, 4, 5 and 1
4 1 5 6 2
4 6 7 3 2
4 3 7 4 0
4 0 1 2 3
4 7 6 5 4 # Face with index 5
# 3D cylinders
1 # One 3D cylinder
8 9 0.04 # Revolution axis between 3D points 8 and 9
# 3D circle
0 # No 3D circle
visp_cao_import.zip
in .gitignore
fileI used the following comments to parse the cao
file.
# 3D points
0
# 3D lines
0
# Faces from 3D lines
0
# Faces from 3D points
0
# 3D cylinders
0
# 3D circles
0
I did a strict, case insensitive match. Should I also include # 3D faces from lines
&# 3D faces from points
?
A line starting with a #
char is a comment. The line should be ignored
There could be multiple lines starting with #
.
A line starting with a # char is a comment. The line should be ignored There could be multiple lines starting with #.
What I meant was I used the comments mentioned in the previous reply to parse the cao
file.
So therefore # 3D faces from lines
and # 3D faces from points
and the data below them were ignored since they did not match # Faces from 3D lines
and # Faces from 3D points
respectively (I did a strict match).
Hence I asked if I should do a strict, case insensitive match or just see if any keywords like face/from/3d/points/lines are mentioned.
To be clear, there shouldn't be a case check for keywords after #
characters since a line starting with #
is an optional comment.
If I consider the previous cube_and_cylinder.cao
file, it's content could be the following (without comments):
V1
10
0.000 0.000 0.000
-0.084 0.000 0.000
-0.084 0.084 0.000
0.000 0.084 0.000
0.000 0.000 0.084
-0.084 0.000 0.084
-0.084 0.084 0.084
0.000 0.084 0.084
-0.170 -0.030 0.000
-0.170 -0.030 0.250
0
0
6
4 0 4 5 1
4 1 5 6 2
4 6 7 3 2
4 3 7 4 0
4 0 1 2 3
4 7 6 5 4
1
8 9 0.04
0
There could be also sometimes comments on 1 or 2 lines like:
V1
# An other example of
# a cube and a cylinder
# There are 10 3D points
10
0.000 0.000 0.000
-0.084 0.000 0.000
-0.084 0.084 0.000
0.000 0.084 0.000
0.000 0.000 0.084
-0.084 0.000 0.084
-0.084 0.084 0.084
0.000 0.084 0.084
-0.170 -0.030 0.000
-0.170 -0.030 0.250
0
0
6
4 0 4 5 1
4 1 5 6 2
4 6 7 3 2
4 3 7 4 0
4 0 1 2 3
4 7 6 5 4
1
8 9 0.04
# We don't model a circle
0
The function that decodes a cao
file is vpMbTracker::loadCAOModel(). It's source code is here.
Ok, I made a mistake then. Thanks for the clarification!
Hi Vikas, even if GSoC is finished do you think that it would be possible for you to integrate my previous comment ?
Yes, I will finish it by this weekend.
Todo:
Import CAO file containing only lines.