lagadic / visp_cao_editor

Development of a CAD model editor for ViSP model-based tracker
GNU General Public License v3.0
19 stars 8 forks source link

Blender Import Plugin #18

Closed vikasTmz closed 7 years ago

vikasTmz commented 7 years ago

Todo:

fspindle commented 7 years ago
vikasTmz commented 7 years ago

I 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 ?

fspindle commented 7 years ago

A line starting with a # char is a comment. The line should be ignored There could be multiple lines starting with #.

vikasTmz commented 7 years ago

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.

fspindle commented 7 years ago

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.

vikasTmz commented 7 years ago

Ok, I made a mistake then. Thanks for the clarification!

fspindle commented 7 years ago

Hi Vikas, even if GSoC is finished do you think that it would be possible for you to integrate my previous comment ?

vikasTmz commented 7 years ago

Yes, I will finish it by this weekend.