-
Notifications
You must be signed in to change notification settings - Fork 26
/
laszip_point.cs
107 lines (97 loc) · 4.31 KB
/
laszip_point.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//===============================================================================
//
// FILE: laszip_point.cs
//
// CONTENTS:
//
// C# port of a simple DLL interface to LASzip.
//
// PROGRAMMERS:
//
// martin.isenburg@rapidlasso.com - http://rapidlasso.com
//
// COPYRIGHT:
//
// (c) 2005-2012, martin isenburg, rapidlasso - tools to catch reality
// (c) of the C# port 2014 by Shinta <shintadono@googlemail.com>
//
// This is free software; you can redistribute and/or modify it under the
// terms of the GNU Lesser General Licence as published by the Free Software
// Foundation. See the COPYING file for more information.
//
// This software is distributed WITHOUT ANY WARRANTY and without even the
// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// CHANGE HISTORY: omitted for easier Copy&Paste (pls see the original)
//
//===============================================================================
namespace laszip.net
{
public class laszip_point
{
public int X;
public int Y;
public int Z;
public ushort intensity;
//public byte return_number : 3;
public byte return_number { get { return (byte)(flags&7); } set { flags=(byte)((flags&0xF8)|(value&7)); } }
//public byte number_of_returns_of_given_pulse : 3;
public byte number_of_returns_of_given_pulse { get { return (byte)((flags>>3)&7); } set { flags=(byte)((flags&0xC7)|((value&7)<<3)); } }
//public byte scan_direction_flag : 1;
public byte scan_direction_flag { get { return (byte)((flags>>6)&1); } set { flags=(byte)((flags&0xBF)|((value&1)<<6)); } }
//public byte edge_of_flight_line : 1;
public byte edge_of_flight_line { get { return (byte)((flags>>7)&1); } set { flags=(byte)((flags&0x7F)|((value&1)<<7)); } }
public byte flags;
public byte classification;
public sbyte scan_angle_rank;
public byte user_data;
public ushort point_source_ID;
public double gps_time;
public ushort[] rgb=new ushort[4];
public byte[] wave_packet=new byte[29];
// LAS 1.4 only
//public byte extended_point_type : 2;
public byte extended_point_type { get { return (byte)(extended_flags&3); } set { extended_flags=(byte)((extended_flags&0xFC)|(value&3)); } }
//public byte extended_scanner_channel : 2;
public byte extended_scanner_channel { get { return (byte)((extended_flags>>2)&3); } set { extended_flags=(byte)((extended_flags&0xF3)|((value&3)<<2)); } }
//public byte extended_classification_flags : 4;
public byte extended_classification_flags { get { return (byte)((extended_flags>>4)&0xF); } set { extended_flags=(byte)((extended_flags&0xF)|((value&0xF)<<4)); } }
public byte extended_flags;
public byte extended_classification;
//public byte extended_return_number : 4;
public byte extended_return_number { get { return (byte)(extended_returns&0xF); } set { extended_returns=(byte)((extended_returns&0xF0)|(value&0xF)); } }
//public byte extended_number_of_returns_of_given_pulse : 4;
public byte extended_number_of_returns_of_given_pulse { get { return (byte)((extended_returns>>4)&0xF); } set { extended_returns=(byte)((extended_returns&0xF)|((value&0xF)<<4)); } }
public byte extended_returns;
public short extended_scan_angle;
public int num_extra_bytes;
public byte[] extra_bytes;
public bool IsSame(laszip_point p)
{
if(X!=p.X) return false;
if(Y!=p.Y) return false;
if(Z!=p.Z) return false;
if(intensity!=p.intensity) return false;
if(flags!=p.flags) return false;
if(classification!=p.classification) return false;
if(scan_angle_rank!=p.scan_angle_rank) return false;
if(user_data!=p.user_data) return false;
if(point_source_ID!=p.point_source_ID) return false;
if(gps_time!=p.gps_time) return false;
if(rgb[0]!=p.rgb[0]) return false;
if(rgb[1]!=p.rgb[1]) return false;
if(rgb[2]!=p.rgb[2]) return false;
if(rgb[3]!=p.rgb[3]) return false;
for(int i=0; i<29; i++)
if(wave_packet[i]!=p.wave_packet[i]) return false;
if(extended_flags!=p.extended_flags) return false;
if(extended_classification!=p.extended_classification) return false;
if(extended_returns!=p.extended_returns) return false;
if(extended_scan_angle!=p.extended_scan_angle) return false;
if(num_extra_bytes!=p.num_extra_bytes) return false;
for(int i=0; i<num_extra_bytes; i++)
if(extra_bytes[i]!=p.extra_bytes[i]) return false;
return true;
}
}
}