SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Please note! These examples are new to SciChart iOS v4 release! SciChart’s OpenGL ES and Metal iOS and Metal macOS Chart library ships with hundred of Objective-C and Swift iOS&macOS Chart Examples which you can browse, play with and view the source-code. All of this is possible with the new and improved SciChart iOS Examples Suite and demo application for Mac, which ships as part of the SciChart SDK.
This example demonstrates how to create complex graphs and visualizations with SciChart iOS and macOS, and for example to visualize the LiDAR data.
LiDAR data can be collected from a variety of sources. We have used the publicly available data set of UAV data of one of the UK regions, which provides data in .asc format. Then we have used SCIScatterRenderableSeries3D with SCIPixelPointMarker3D and SCISurfaceMeshRenderableSeries3D to draw it on the chart.
You can see this graphics on your iPhone, iPad, and Mac desktop. It is used across domains anything from defence to energy, civil engineering and more.
Read more in SciChart Blog about LiDAR UAV 3D Point-cloud and Contour Visualisation in WPF,iOS,Android & Javascript
The Swift and Objective-C source code for the iOS and macOS 3D LiDAR Point Cloud Chart example is included below (Scroll down!).
Did you know that we have the source code for all our example available for free on Github?
Clone the SciChart.iOS.Examples from Github.
Also the SciChart iOS and Scichart macOS Trials contain the full source for the examples (link below).
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2020. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// LidarPointCloud.m is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
#import "LidarPointCloud.h"
#import "SCDDataManager.h"
NSString *const SCDLIDARTQ38sw = @"tq3080_DSM_2M.asc";
@implementation LidarPointCloud
- (Class)associatedType { return SCIChartSurface3D.class; }
- (void)initExample {
SCIColorMap *colorMap = [[SCIColorMap alloc] initWithColors:@[[SCIColor fromARGBColorCode:0xFF1E90FF], [SCIColor fromARGBColorCode:0xFF32CD32], SCIColor.orangeColor, SCIColor.redColor, SCIColor.purpleColor] andStops:@[@(0), @(0.2), @(0.5), @(0.7), @(1)]];
SCINumericAxis3D *xAxis = [SCINumericAxis3D new];
xAxis.axisTitle = @"X Distance (metres)";
xAxis.textFormatting = @"0m";
SCINumericAxis3D *yAxis = [SCINumericAxis3D new];
yAxis.axisTitle = @"Y Distance (metres)";
yAxis.textFormatting = @"0m";
yAxis.visibleRange = [[SCIDoubleRange alloc] initWithMin:0 max:50];
SCINumericAxis3D *zAxis = [SCINumericAxis3D new];
zAxis.axisTitle = @"Height (metres)";
zAxis.textFormatting = @"0m";
SCDAscData *lidarData = [SCDDataManager ascDataFromFile:SCDLIDARTQ38sw];
SCIScatterRenderableSeries3D *scatterSeries = [SCIScatterRenderableSeries3D new];
scatterSeries.pointMarker = [SCIPixelPointMarker3D new];
scatterSeries.dataSeries = [lidarData createXyzDataSeries];
scatterSeries.metadataProvider = [lidarData createMetadataProviderWithColorMap:colorMap withinMin:0 andMax:50];
unsigned int fillColors[5] = { 0xFF1E90FF, 0xFF32CD32, SCIColor.orangeColor.colorARGBCode, SCIColor.redColor.colorARGBCode, SCIColor.purpleColor.colorARGBCode };
float fillStops[5] = { 0.0, 0.2, 0.5, 0.7, 1.0 };
SCISurfaceMeshRenderableSeries3D *surfaceMeshSeries = [SCISurfaceMeshRenderableSeries3D new];
surfaceMeshSeries.dataSeries = [lidarData createUniformGridDataSeries];
surfaceMeshSeries.drawMeshAs = SCIDrawMeshAs_SolidWithContours;
surfaceMeshSeries.meshColorPalette = [[SCIGradientColorPalette alloc] initWithColors:fillColors stops:fillStops count:5];
surfaceMeshSeries.meshPaletteMode = SCIMeshPaletteMode_HeightMapInterpolated;
surfaceMeshSeries.contourStroke = 0xFFF0FFFF;
surfaceMeshSeries.contourStrokeThickness = 2;
surfaceMeshSeries.minimum = 0;
surfaceMeshSeries.maximum = 50;
surfaceMeshSeries.opacity = 0.5;
SCIZoomExtentsModifier3D *zoomExtentsModifier = [SCIZoomExtentsModifier3D new];
zoomExtentsModifier.resetPosition = [[SCIVector3 alloc] initWithX:800 y:1000 z:800];
zoomExtentsModifier.resetTarget = [[SCIVector3 alloc] initWithX:0 y:25 z:0];
[SCIUpdateSuspender usingWithSuspendable:self.surface withBlock:^{
self.surface.xAxis = xAxis;
self.surface.yAxis = yAxis;
self.surface.zAxis = zAxis;
[self.surface.renderableSeries addAll:scatterSeries, surfaceMeshSeries, nil];
[self.surface.chartModifiers addAll:[SCIOrbitModifier3D new], zoomExtentsModifier, [SCIPinchZoomModifier3D new], nil];
[self.surface.camera.position assignX:800 y:1000 z:800];
[self.surface.worldDimensions assignX:1000 y:200 z:1000];
}];
}
@end
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2020. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// LidarPointCloud.swift is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
class LidarPointCloud: SCDSingleChartViewController<SCIChartSurface3D> {
override var associatedType: AnyClass { return SCIChartSurface3D.self }
let LIDARTQ38sw = "tq3080_DSM_2M.asc"
let colorMap = SCIColorMap(colors: [SCIColor.fromARGBColorCode(0xFF1E90FF), SCIColor.fromARGBColorCode(0xFF32CD32), .orange, .red, .purple], andStops: [0, 0.2, 0.5, 0.7, 1])
override func initExample() {
let xAxis = SCINumericAxis3D()
xAxis.axisTitle = "X Distance (metres)"
xAxis.textFormatting = "0m"
let yAxis = SCINumericAxis3D()
yAxis.axisTitle = "Y Distance (metres)"
yAxis.textFormatting = "0m"
yAxis.visibleRange = SCIDoubleRange(min: 0, max: 50)
let zAxis = SCINumericAxis3D()
zAxis.axisTitle = "Height (metres)"
zAxis.textFormatting = "0m"
let scatterSeries = SCIScatterRenderableSeries3D()
scatterSeries.pointMarker = SCIPixelPointMarker3D()
let surfaceMeshSeries = SCISurfaceMeshRenderableSeries3D()
surfaceMeshSeries.drawMeshAs = .solidWithContours
surfaceMeshSeries.meshColorPalette = SCIGradientColorPalette(
colors: [0xFF1E90FF, 0xFF32CD32, SCIColor.orange.colorARGBCode(), SCIColor.purple.colorARGBCode()],
stops: [0.0, 0.2, 0.5, 0.7, 1.0]
)
surfaceMeshSeries.meshPaletteMode = .heightMapInterpolated
surfaceMeshSeries.contourStroke = 0xFFF0FFFF
surfaceMeshSeries.contourStrokeThickness = 2
surfaceMeshSeries.minimum = 0
surfaceMeshSeries.maximum = 50
surfaceMeshSeries.opacity = 0.5
if let lidarData = SCDDataManager.ascData(fromFile: LIDARTQ38sw) {
scatterSeries.dataSeries = lidarData.createXyzDataSeries()
scatterSeries.metadataProvider = lidarData.createMetadataProvider(with: colorMap, withinMin: 0, andMax: 50)
surfaceMeshSeries.dataSeries = lidarData.createUniformGridDataSeries()
}
let zoomExtentsModifier = SCIZoomExtentsModifier3D()
zoomExtentsModifier.resetPosition = SCIVector3(x: 800, y: 1000, z: 800)
zoomExtentsModifier.resetTarget = SCIVector3(x: 0, y: 25, z: 0)
SCIUpdateSuspender.usingWith(surface) {
self.surface.xAxis = xAxis
self.surface.yAxis = yAxis
self.surface.zAxis = zAxis
self.surface.renderableSeries.add(items: scatterSeries, surfaceMeshSeries)
self.surface.chartModifiers.add(items: SCIOrbitModifier3D(), zoomExtentsModifier, SCIPinchZoomModifier3D())
self.surface.camera.position.assignX(800, y: 1000, z: 800)
self.surface.worldDimensions.assignX(1000, y: 200, z: 1000)
}
}
}