Skip to content

Commit e516274

Browse files
authored
Support large pcd (#259)
- Fix large map (>30M points) rendering on Firefox - Reduce number of points to render while moving the viewpoint
1 parent 2fcbb6b commit e516274

File tree

7 files changed

+451
-389
lines changed

7 files changed

+451
-389
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Go
2020
uses: actions/setup-go@v5
2121
with:
22-
go-version: '1.18'
22+
go-version: '1.23'
2323
- name: Enable pnpm
2424
run: corepack enable pnpm
2525
- uses: actions/setup-node@v4

README.md

+39-37
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,45 @@ Enter | 貼り付けの確定
9090

9191
### コマンド操作
9292

93-
コマンド | 動作
94-
----------------------------- | -------------------------------------------------------
95-
cursor | 選択中の点の一覧を表示 (`ID` `X` `Y` `Z`) [\*1](#footnoteKey1)
96-
cursor `X` `Y` `Z` | 新しい点(`X`, `Y`, `Z`)を選択
97-
cursor `ID` `X` `Y` `Z` | 指定した `ID` の選択中の点の座標を(`X`, `Y`, `Z`)に設定
98-
unset\_cursor | 点の選択を解除
99-
select\_range | 選択領域厚を表示 (`R`) [\*1](#footnoteKey1)
100-
select\_range `R` | 選択領域厚を `R` \[メートル\]に設定
101-
snap\_v | 3点目を垂直スナップ
102-
snap\_h | 2, 3点目を水平スナップ
103-
translate\_cursor `X` `Y` `Z` | 選択中の点を平行移動
104-
add\_surface | 面作成
105-
add\_surface `R` | 面作成 (点の間隔 `R` \[メートル\])
106-
delete | 削除
107-
label `L` | ラベル設定 (`L`)
108-
undo | Undo
109-
max\_history | Undo回数を表示
110-
max\_history `A` | Undo回数を設定 (`A`: 0-)
111-
crop | 表示範囲を選択範囲に限定 (無選択での場合は解除)
112-
map\_alpha | 2Dマップの透明度を表示 (`A`) [\*1](#footnoteKey1)
113-
map\_alpha `A` | 2Dマップの透明度を設定 (`A`: 0-1)
114-
voxel\_grid | VoxelGridフィルタで点数を削減
115-
voxel\_grid `R` | VoxelGridフィルタで点数を削減 (voxelサイズ `R` \[メートル\])
116-
z\_range | 色をつけるZ座標の範囲を表示 [\*1](#footnoteKey1)
117-
z\_range `Min` `Max` | 色をつけるZ座標の範囲を `Min` - `Max` \[メートル\]に設定
118-
perspective | 透視投影モード
119-
ortho | 正投影モード
120-
point\_size | 点の表示サイズを表示 [\*1](#footnoteKey1)
121-
point\_size `Size` | 点の表示サイズを `Size` に設定
122-
segmentation\_param | セグメンテーション時の分離距離を表示 [\*1](#footnoteKey1)
123-
segmentation\_param `D` `R` | セグメンテーション時の分離距離を `D` \[メートル\]、適用範囲を `R` \[メートル\]に設定
124-
fit\_inserting `AXIS`... | 貼り付け中の点群を既存の点群に位置合わせ [\*2](#footnoteKey2) (位置合わせを行う軸 `AXIS` をスペース区切りで複数指定 [\*3](#footnoteKey3))
125-
label_segmentation\_param | ラベルを元にしてのセグメンテーション時の範囲と隣接する点群の最大距離を表示 [\*1](#footnoteKey1)
126-
label_segmentation\_param `D` `R` | ラベルを元にしてのセグメンテーション時の隣接する点群の最大距離を `D` \[メートル\]、範囲を `R` \[メートル\]に設定
127-
render_label_range `Min` `Max` | `Min` - `Max`の範囲内のラベルのみに色をつけて表示
128-
relabel `Min` `Max` `New` | `Min` - `Max`の範囲内のラベルを`New`値に設定
129-
unlabel `label1` `label2` `...` | `label1, label2, ...`以外のラベルを`0`に設定
93+
コマンド | 動作
94+
---------------------------------- | -------------------------------------------------------
95+
cursor | 選択中の点の一覧を表示 (`ID` `X` `Y` `Z`) [\*1](#footnoteKey1)
96+
cursor `X` `Y` `Z` | 新しい点(`X`, `Y`, `Z`)を選択
97+
cursor `ID` `X` `Y` `Z` | 指定した `ID` の選択中の点の座標を(`X`, `Y`, `Z`)に設定
98+
unset\_cursor | 点の選択を解除
99+
select\_range | 選択領域厚を表示 (`R`) [\*1](#footnoteKey1)
100+
select\_range `R` | 選択領域厚を `R` \[メートル\]に設定
101+
snap\_v | 3点目を垂直スナップ
102+
snap\_h | 2, 3点目を水平スナップ
103+
translate\_cursor `X` `Y` `Z` | 選択中の点を平行移動
104+
add\_surface | 面作成
105+
add\_surface `R` | 面作成 (点の間隔 `R` \[メートル\])
106+
delete | 削除
107+
label `L` | ラベル設定 (`L`)
108+
undo | Undo
109+
max\_history | Undo回数を表示
110+
max\_history `A` | Undo回数を設定 (`A`: 0-)
111+
crop | 表示範囲を選択範囲に限定 (無選択での場合は解除)
112+
map\_alpha | 2Dマップの透明度を表示 (`A`) [\*1](#footnoteKey1)
113+
map\_alpha `A` | 2Dマップの透明度を設定 (`A`: 0-1)
114+
voxel\_grid | VoxelGridフィルタで点数を削減
115+
voxel\_grid `R` | VoxelGridフィルタで点数を削減 (voxelサイズ `R` \[メートル\])
116+
z\_range | 色をつけるZ座標の範囲を表示 [\*1](#footnoteKey1)
117+
z\_range `Min` `Max` | 色をつけるZ座標の範囲を `Min` - `Max` \[メートル\]に設定
118+
perspective | 透視投影モード
119+
ortho | 正投影モード
120+
point\_size | 点の表示サイズを表示 [\*1](#footnoteKey1)
121+
point\_size `Size` | 点の表示サイズを `Size` に設定
122+
segmentation\_param | セグメンテーション時の分離距離を表示 [\*1](#footnoteKey1)
123+
segmentation\_param `D` `R` | セグメンテーション時の分離距離を `D` \[メートル\]、適用範囲を `R` \[メートル\]に設定
124+
fit\_inserting `AXIS`... | 貼り付け中の点群を既存の点群に位置合わせ [\*2](#footnoteKey2) (位置合わせを行う軸 `AXIS` をスペース区切りで複数指定 [\*3](#footnoteKey3))
125+
label\_segmentation\_param | ラベルを元にしてのセグメンテーション時の範囲と隣接する点群の最大距離を表示 [\*1](#footnoteKey1)
126+
label\_segmentation\_param `D` `R` | ラベルを元にしてのセグメンテーション時の隣接する点群の最大距離を `D` \[メートル\]、範囲を `R` \[メートル\]に設定
127+
render\_label\_range `Min` `Max` | `Min` - `Max`の範囲内のラベルのみに色をつけて表示
128+
relabel `Min` `Max` `New` | `Min` - `Max`の範囲内のラベルを`New`値に設定
129+
unlabel `label1` `label2` `...` | `label1, label2, ...`以外のラベルを`0`に設定
130+
num\_fast\_render\_points | 操作中に表示する点の最大数を表示
131+
num\_fast\_render\_points `N` | 操作中に表示する点の最大数を `N` に設定
130132

131133
<dl>
132134
<dt><a id="footnoteKey1">[1] 数値の表示</a></dt><dd>

command.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const (
2323
defaultZMin = -5.0
2424
defaultZMax = 5.0
2525
defaultPointSize = 40.0
26+
defaultNumFastRenderPoints = 15000000
2627
defaultSegmentationDistance = 0.08
2728
defaultSegmentationRange = 5.0
2829

@@ -86,7 +87,8 @@ type commandContext struct {
8687
zMin, zMax float32
8788
projectionType ProjectionType
8889

89-
pointSize float32
90+
pointSize float32
91+
numFastRenderPoints int
9092

9193
selectMode selectMode
9294

@@ -127,6 +129,7 @@ func (c *commandContext) Reset() {
127129
c.zMin = defaultZMin
128130
c.zMax = defaultZMax
129131
c.pointSize = defaultPointSize
132+
c.numFastRenderPoints = defaultNumFastRenderPoints
130133
c.segmentationDistance = defaultSegmentationDistance
131134
c.segmentationRange = defaultSegmentationRange
132135
c.labelSegmentationRange = defaultLabelSegmentationRange
@@ -177,6 +180,17 @@ func (c *commandContext) SetPointSize(ps float32) error {
177180
return nil
178181
}
179182

183+
func (c *commandContext) NumFastRenderPoints() int {
184+
return c.numFastRenderPoints
185+
}
186+
187+
func (c *commandContext) SetNumFastRenderPoints(n int) error {
188+
if n <= 100000 {
189+
return errors.New("num fast render points must be >100000")
190+
}
191+
c.numFastRenderPoints = n
192+
return nil
193+
}
180194
func (c *commandContext) SegmentationParam() (float32, float32) {
181195
return c.segmentationDistance, c.segmentationRange
182196
}

console.go

+10
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ var consoleCommands = map[string]func(c *console, updateSel updateSelectionFn, a
194194
return nil, errArgumentNumber
195195
}
196196
},
197+
"num_fast_render_points": func(c *console, updateSel updateSelectionFn, args []float32) ([][]float32, error) {
198+
switch len(args) {
199+
case 0:
200+
return [][]float32{{float32(c.cmd.NumFastRenderPoints())}}, nil
201+
case 1:
202+
return nil, c.cmd.SetNumFastRenderPoints(int(args[0]))
203+
default:
204+
return nil, errArgumentNumber
205+
}
206+
},
197207
"fov": func(c *console, updateSel updateSelectionFn, args []float32) ([][]float32, error) {
198208
switch len(args) {
199209
case 1:

go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module github.com/seqsense/pcdeditor
22

3-
go 1.16
3+
go 1.21
44

55
require (
66
github.com/seqsense/pcgol v0.0.0-20231024030105-2d5508f2110b
77
github.com/seqsense/webgl-go v0.0.0-20231106035007-6fa7160d45ce
88
gopkg.in/yaml.v3 v3.0.1
99
)
10+
11+
require github.com/zhuyie/golzf v0.0.0-20161112031142-8387b0307ade // indirect

0 commit comments

Comments
 (0)