4 Copyright (c) 2016, Aumann Florian, Borella Jocelyn, Heller Florian, Meissner Pascal, Schleicher Ralf, Stoeckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij 7 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 9 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 11 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 13 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 15 4. The use is explicitly not permitted to any application which deliberately try to kill or do harm to any living creature. 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 return "Region: " + str(self.
Region) +
"\nNormals: " + str(self.
Normals)
33 return [(point[3]-point[0]),(point[4]-point[1]),(point[5]-point[2])]
36 return [point[0],point[1],point[2]]
46 opts, args = getopt.getopt(sys.argv[1:],
"hi:o:",[
"ifile=",
"ofile="])
48 print 'RegionToCropBox.py -i <inputfile>.csv -o <outputfile>.xml' 52 print 'RegionToCropBox.py -i <inputfile>.csv -o <outputfile>.xml' 54 elif opt
in (
"-i",
"--ifile"):
56 elif opt
in (
"-o",
"--ofile"):
58 print 'Input file is "', inputfile
59 print 'Output file is "', outputfile
61 with open(inputfile,
'rb')
as csvfile:
62 spamreader = csv.reader(csvfile, delimiter=
',', quotechar=
'|')
66 for row
in spamreader:
67 if len(row) != 0
and str(row[0]).startswith(
'#'):
69 if len(row) == 0
and isFirst
is True:
74 Cropboxes.append(cropbox)
78 if isNormalsRead
is False:
81 region.append(float(elt))
82 cropbox.Region = region
87 normal.append(float(elt))
88 cropbox.Normals.append(normal)
90 returnString =
'<CropBoxList name="Map">' 92 returnString +=
'<CropBox name="Region_'+str(i)+
'">' 93 returnString +=
'<min_pt x="0" y="0" z="0"/>' 95 if max_point[0] < 0.0
or max_point[1] < 0.0
or max_point[2] < 0.0:
96 print "ABORTING: Max values must be positive for PCL crop box filtering." 98 returnString +=
'<max_pt x="'+str(max_point[0])+
'" y="'+str(max_point[1])+
'" z="'+str(max_point[2])+
'"/>' 99 returnString +=
'<rotation x="0" y="0" z="0"/>' 101 returnString +=
' <translation x="'+str(translation[0])+
'" y="'+str(translation[1])+
'" z="'+str(translation[2])+
'"/>' 104 returnString +=
' <normal_' + str(j) +
' x="'+str(n[0])+
'" y="'+str(n[1])+
'" z="'+str(n[2])+
'"/>' 106 returnString +=
'</CropBox>' 109 returnString +=
'</CropBoxList>' 111 f = open(outputfile,
'r+')
113 f.write(returnString)
118 if __name__ ==
'__main__':
def get_translation(point)