77 lines
3.5 KiB
Plaintext
77 lines
3.5 KiB
Plaintext
########################################
|
|
# INITIALIZATION
|
|
########################################
|
|
delete database pc2test;
|
|
|
|
#setup pc2test Pointcloud2Algebra
|
|
create database pc2test;
|
|
open database pc2test;
|
|
|
|
let pc_undef = [const pointcloud2(EUCLID) value (undefined)];
|
|
let pc_empty = [const pointcloud2(EUCLID) value ()];
|
|
let pc_points = [const pointcloud2(EUCLID) value ((1 2 3) (3.0 1.0 2) (2 3 1.0))];
|
|
let pc_wtuple = [const pointcloud2(EUCLID
|
|
(tuple([Name: string, Value: real])))
|
|
value ( (3 1 4 ("Pi" 3.1415))
|
|
(2 7 1 ("Euler" 2.71828 ))
|
|
(1 4 1 ("Wurzel2" 1.4142)) )];
|
|
let pc_ObjButNoCat = [const pointcloud2(EUCLID
|
|
(tuple([Name: string, ObjID: int])))
|
|
value ( (3 1 4 ("eins" 1))
|
|
(2 7 1 ("zwei" 2))
|
|
(1 4 1 ("drei" 3)) )];
|
|
let pc_ObjAndCat = [const pointcloud2(EUCLID
|
|
(tuple([CatID: int, Name: string, ObjID: int])))
|
|
value ( (3 1 4 (1 "Cat 1 Obj 1" 1))
|
|
(2 7 1 (1 "Cat 1 Obj 2" 2))
|
|
(1 4 1 (2 "Cat 2 Obj 3" 3)) )];
|
|
|
|
########################################
|
|
# OPERATOR - TESTS
|
|
########################################
|
|
|
|
#testcase -1- analyze undefined cloud
|
|
#yields ((pointcloud2 (EUCLID (tuple((ObjID int) (CatID int)) ))) undefined)
|
|
query pc_undef analyzeGeom;
|
|
|
|
#testcase -2- analyze empty cloud, only adding attributes ObjID and CatID
|
|
#yields ((pointcloud2 (EUCLID (tuple((ObjID int) (CatID int)) ))) ())
|
|
query pc_empty analyzeGeom;
|
|
|
|
#testcase -3- analyze points, but nothing to be found
|
|
#yields ((pointcloud2 (EUCLID(tuple ((ObjID int)(CatID int)) ))) ( (1.0 2.0 3.0 (0 0)) (3.0 1.0 2.0 (0 0)) (2.0 3.0 1.0 (0 0))))
|
|
query pc_points analyzeGeom;
|
|
|
|
#testcase -4- add ObjID and CatID to existing attributes Name and Value
|
|
#yields ((pointcloud2 (EUCLID (tuple((Name string) (Value real) (ObjID int) (CatID int))))) ( (3.0 1.0 4.0 ("Pi" 3.1415 0 0)) (2.0 7.0 1.0 ("Euler" 2.71828 0 0)) (1.0 4.0 1.0 ("Wurzel2" 1.4142 0 0))))
|
|
query pc_wtuple analyzeGeom;
|
|
|
|
#testcase -5- cloud has ObjID but no CatID, analysis is denied
|
|
#yields error
|
|
query pc_ObjButNoCat analyzeGeom;
|
|
|
|
#testcase -6- existing attribute values for ObjID and CatID are overwritten with 0
|
|
#yields ((pointcloud2 (EUCLID (tuple ((CatID int)(Name string)(ObjID int)) ))) ((3.0 1.0 4.0 (0 "Cat 1 Obj 1" 0)) (2.0 7.0 1.0 (0 "Cat 1 Obj 2" 0)) (1.0 4.0 1.0 (0 "Cat 2 Obj 3" 0))))
|
|
query pc_ObjAndCat analyzeGeom;
|
|
|
|
#testcase -7- number of recognized objects
|
|
#yields ((rel (tuple((CatID int)(ObjCount int)))) ( (1 1)(2 2)(3 3)(4 4) ))
|
|
query createPc2Shapes(1, 2, 3, 4, 0.1, 3.0, 4.0, 20.0, 0.01, 0, 1) analyzeGeom feed project[CatID,ObjID] sortby[CatID,ObjID] groupby[CatID,ObjID; Cnt: group count] groupby[CatID; ObjCount: group count] consume
|
|
|
|
#testcase -8- change parameter
|
|
#yields (bool TRUE)
|
|
query pc2SetParam("MINIMUM_OBJECT_EXTENT",10.0)
|
|
|
|
#testcase -9- number of recognized noise and objects with new parameter
|
|
#yields ((rel (tuple((CatID int)(ObjCount int)))) ( (0 1)(1 4)(2 3)(3 2)(4 1) ))
|
|
query createPc2Shapes(4,3,2,1, 0.5, 10.0, 12.0, 200.0, 0.02, 500, 1) analyzeGeom feed project[CatID,ObjID] sortby[CatID,ObjID] groupby[CatID,ObjID; Cnt: group count] groupby[CatID; ObjCount: group count] consume
|
|
|
|
#teardown
|
|
kill pc_undef;
|
|
kill pc_empty;
|
|
kill pc_points;
|
|
kill pc_wtuple;
|
|
kill pc_ObjButNoCat;
|
|
kill pc_ObjAndCat;
|
|
close database;
|
|
delete database pc2test; |