三维未激活采样显示灰点,二维增加深度叠箭头。
分析对话框默认使用传感器对话框保存的标定,关闭按钮改为保存。框选曲线时数值卡片仍显示光标读数。相关单测通过。
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
from orisys_app_shared.scene3d.overlays import (
|
||||
arrow_instances_to_mesh,
|
||||
build_flow_overlay,
|
||||
@@ -10,7 +11,7 @@ from orisys_app_shared.scene3d.overlays import (
|
||||
force_visual_strength,
|
||||
)
|
||||
from orisys_app_shared.scene3d.synthetic import poc_scene
|
||||
from orisys_app_shared.scene3d.visual_policy import VisualPolicy, select_flow_samples
|
||||
from orisys_app_shared.scene3d.visual_policy import FlowSamples, VisualPolicy, select_flow_samples
|
||||
|
||||
|
||||
def test_force_visual_strength_is_capped() -> None:
|
||||
@@ -58,6 +59,30 @@ def test_flow_and_normal_overlays_on_poc_mapping() -> None:
|
||||
assert colors.shape[0] == positions.shape[0]
|
||||
|
||||
|
||||
def test_an_inactive_sample_is_a_grey_point_and_an_active_one_is_an_arrow() -> None:
|
||||
assets = poc_scene()
|
||||
mapping = assets.surface_mapping
|
||||
assert mapping is not None
|
||||
samples = FlowSamples(
|
||||
rows=np.asarray([1, 1], dtype=np.int32),
|
||||
cols=np.asarray([1, 2], dtype=np.int32),
|
||||
dx=np.asarray([0.8, 0.0]),
|
||||
dy=np.asarray([0.0, 0.0]),
|
||||
magnitude=np.asarray([1.6, 0.0]),
|
||||
active=np.asarray([True, False]),
|
||||
)
|
||||
arrows, diags = build_flow_overlay(samples, mapping)
|
||||
assert not diags
|
||||
assert int(np.count_nonzero(arrows.lengths > 0.0)) == 1
|
||||
assert int(np.count_nonzero(arrows.lengths < 0.0)) == 1
|
||||
idle = arrows.colors[arrows.lengths < 0.0][0]
|
||||
# Brand idle tint #8A93A6, not a ramp colour.
|
||||
assert idle[0] == pytest.approx(0x8A / 255.0, abs=0.02)
|
||||
assert idle[2] == pytest.approx(0xA6 / 255.0, abs=0.02)
|
||||
positions, _triangles, colors = arrow_instances_to_mesh(arrows)
|
||||
assert positions.shape[0] == colors.shape[0] > 0
|
||||
|
||||
|
||||
def test_missing_contact_yields_no_arrow() -> None:
|
||||
assets = poc_scene()
|
||||
mapping = assets.surface_mapping
|
||||
|
||||
Reference in New Issue
Block a user