Skip to content

Commit 73e0f85

Browse files
authored
Offset bugfix that always resulted in an offset of 1 (#29)
* Added Table write interface for XYZ fields, includes conversion. * Added conversion of other fields as well. * Fixed offset bug. * Also update test. * Up version.
1 parent 11d8297 commit 73e0f85

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
deps/deps.jl
55
deps/usr
66
*.DS_Store
7+
*.laz

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LazIO"
22
uuid = "c3605908-9f0f-11e8-0a72-0d361c15a277"
33
authors = ["Maarten Pronk <git@evetion.nl>"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

src/table.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function determine_offset(min_value, max_value, scale; threshold=10^7)
1717
# Try to convert back and forth and check overflow
1818
(muladd(round(Int32, (min_value - s) / scale), scale, s) > 0) == (min_value > 0) || error("Can't fit offset in this scale, try to coarsen it.")
1919
(muladd(round(Int32, (max_value - s) / scale), scale, s) > 0) == (max_value > 0) || error("Can't fit offset in this scale, try to coarsen it.")
20+
s
2021
end
2122

2223
"""Correctly set fields that require conversion or packing."""

test/testio.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end
8888
ds = LazIO.open(manual_fn)
8989

9090
@test length(ds) == 3
91-
@test first(ds).X == 1099901
91+
@test first(ds).X == 1100001
9292
@test muladd(first(ds).X, ds.header.x_scale_factor, ds.header.x_offset) 11000.01
9393
@test LasIO.classification(first(ds)) == LazIO.classes.ground
9494
end

0 commit comments

Comments
 (0)