Skip to content

Commit c05c8b1

Browse files
committed
Support scaling per dimension via Tables.
1 parent 35579ac commit c05c8b1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/table.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Base.setproperty!(p::LazPoint, name, value, header)
4141
end
4242
end
4343

44-
function write(fn::AbstractString, table, bbox; scale=0.01, kwargs...)
44+
function write(fn::AbstractString, table, bbox; scalex=0.01, scaley=0.01, scalez=0.01, kwargs...)
4545

4646
schema = Tables.schema(table)
4747
isnothing(schema) && error("A Schema is required")
@@ -50,12 +50,12 @@ function write(fn::AbstractString, table, bbox; scale=0.01, kwargs...)
5050
rows = Tables.rows(table)
5151

5252
header = LazHeader(;kwargs...)
53-
header.x_offset = determine_offset(bbox.min_x, bbox.max_x, scale)
54-
header.y_offset = determine_offset(bbox.min_y, bbox.max_y, scale)
55-
header.z_offset = determine_offset(bbox.min_z, bbox.max_z, scale)
56-
header.x_scale_factor = scale
57-
header.y_scale_factor = scale
58-
header.z_scale_factor = scale
53+
header.x_offset = determine_offset(bbox.min_x, bbox.max_x, scalex)
54+
header.y_offset = determine_offset(bbox.min_y, bbox.max_y, scaley)
55+
header.z_offset = determine_offset(bbox.min_z, bbox.max_z, scalez)
56+
header.x_scale_factor = scalex
57+
header.y_scale_factor = scaley
58+
header.z_scale_factor = scalez
5959

6060
p = LazPoint()
6161

test/testio.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171
@test first(ds) isa LazIO.LazPoint
7272
@inferred first(Tables.rows(ds))
7373

74-
LazIO.write("test_table.laz", ds, LazIO.bounds(ds), scale=0.1)
74+
LazIO.write("test_table.laz", ds, LazIO.bounds(ds), scalex=0.1)
7575
close(ds)
7676

7777
manual_fn = "test_table_manual.laz"
@@ -83,7 +83,7 @@ end
8383
return_number = [1,2,1],
8484
number_of_returns = [1,2,3])
8585
bounds = (min_x = 11000.01, max_x = 32000., min_y = 11000., max_y = 32000., min_z = 11000., max_z = 32000.01)
86-
LazIO.write(manual_fn, table, bounds, scale=0.01, system_identifier=LazIO.writestring("Laser shooter, pew pew!", 32))
86+
LazIO.write(manual_fn, table, bounds, scalex=0.01, system_identifier=LazIO.writestring("Laser shooter, pew pew!", 32))
8787

8888
ds = LazIO.open(manual_fn)
8989

0 commit comments

Comments
 (0)