Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc improvements to pointcloud viz: #33

Merged
merged 4 commits into from Aug 22, 2019
Merged
Changes from 3 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -0,0 +1,17 @@
## [Unreleased]
### Added

### Removed

### Changed

### Fixed


## [0.1.11] - 2019-08-19
### Added
- Pointcloud color, intensity channels
- Pointcloud performance optimizations

### Fixed
- Pointcloud rendering

Some generated files are not rendered by default. Learn more.

@@ -5,7 +5,7 @@ export const OBJECT_TYPE_ARROW = 'Arrow';
export const OBJECT_TYPE_AXES = 'Axes';
export const OBJECT_TYPE_FLAT_ARROW = 'FlatArrow';

export const MAX_POINTCLOUD_POINTS = 100000;
export const MAX_POINTCLOUD_POINTS = 500000;

This comment has been minimized.

Copy link
@tocttou

tocttou Aug 19, 2019

Author Collaborator

Many pointclouds do not fit inside 100,000 points. 500,000 seems to be a better default to avoid confusion to the users (comes at the cost of extra memory). Ideally the buffer should resize if the number of data points change.


export const DEFAULT_BACKGROUND_COLOR = '#000000';
export const DEFAULT_GRID_SIZE = 30;
@@ -74,6 +74,17 @@ export const VIZ_TYPE_TF = 'Tf';
* Viz specific constants
* ************************** */

export const POINT_FIELD_DATATYPES = {
INT8: 1,
UINT8: 2,
INT16: 3,
UINT16: 4,
INT32: 5,
UINT32: 6,
FLOAT32: 7,
FLOAT64: 8
};

export const COLLISION_OBJECT_OPERATIONS = {
ADD: 0,
REMOVE: 1,
@@ -128,6 +139,11 @@ export const COLOR_TRANSFORMERS = {
FLAT_COLOR: 'FlatColor',
};

export const POINTCLOUD_COLOR_CHANNELS = {
RGB: 'rgb',
INTENSITY: 'intensity',
};

export const AXES = {
X: 'x',
Y: 'y',
@@ -279,6 +295,9 @@ export const DEFAULT_OPTIONS_PLANNINGSCENE = {};

export const DEFAULT_OPTIONS_POINTCLOUD = {
compression: 'cbor',
colorChannel: 'rgb',
This conversation was marked as resolved by tocttou

This comment has been minimized.

Copy link
@chaitanya-deep

chaitanya-deep Aug 19, 2019

Collaborator

Replace with POINTCLOUD_COLOR_CHANNELS.RGB

size: 0.0125,
useRainbow: false
};

export const DEFAULT_OPTIONS_POLYGON = {
@@ -0,0 +1,47 @@
import * as THREE from 'three';
import { MAX_POINTCLOUD_POINTS, POINT_FIELD_DATATYPES } from './constants';

export const getAccessorForDataType = (dataView, dataType) => {
switch (dataType) {
case POINT_FIELD_DATATYPES.INT8: {
return dataView.getInt8;
}
case POINT_FIELD_DATATYPES.UINT8: {
return dataView.getUint8;
}
case POINT_FIELD_DATATYPES.INT16: {
return dataView.getInt16;
}
case POINT_FIELD_DATATYPES.UINT16: {
return dataView.getUint16;
}
case POINT_FIELD_DATATYPES.INT32: {
return dataView.getInt32;
}
case POINT_FIELD_DATATYPES.UINT32: {
return dataView.getUint32;
}
case POINT_FIELD_DATATYPES.FLOAT64: {
return dataView.getFloat64;
}
case POINT_FIELD_DATATYPES.FLOAT32:
default: {
return dataView.getFloat32;
}
}
};

export const setOrUpdateGeometryAttribute = (geometry, attribute, data) => {
if (geometry.attributes[attribute] === undefined) {
geometry.addAttribute(
attribute,
new THREE.BufferAttribute(
new Float32Array(data, 0, MAX_POINTCLOUD_POINTS * 3),
3,
).setDynamic(true),
);
} else {
geometry.attributes[attribute].array = data;
}
geometry.attributes[attribute].needsUpdate = true;
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.