Пример #1
0
        /// <summary>
        /// Parse the AR-Foundation feature point cloud.
        /// </summary>
        /// <param name="rawData"></param>
        /// <param name="startIndex"></param>
        /// <param name="receivedPointCloud"></param>
        public static void ParseFeaturePointCloud(byte[] rawData, int startIndex, ref ConcurrentPointCloud receivedPointCloud)
        {
            // read header
            var camPosition            = ParserHelper.ToCartesianVectorMMPrecision(rawData, ref startIndex);
            var camRotationEulerAngles = ParserHelper.ToCartesianVectorMMPrecision(rawData, ref startIndex);
            var touchPosition          = ParserHelper.ToVector2D(rawData, ref startIndex);
            var touchDelta             = ParserHelper.ToVector2D(rawData, ref startIndex);
            var pointCount             = ParserHelper.ToInt(rawData, ref startIndex);

            //read points
            for (var i = 0; i < pointCount; i++)
            {
                var id    = ParserHelper.ToULong(rawData, ref startIndex);
                var p     = ParserHelper.ToCartesianVectorMMPrecision(rawData, ref startIndex);
                var color = ParserHelper.ToColor(rawData, ref startIndex);
                if (!receivedPointCloud.Points.ContainsKey(id))
                {
                    receivedPointCloud.Points.TryAdd(id, p);
                }
                else
                {
                    receivedPointCloud.Points[id] = p;
                }

                if (!receivedPointCloud.Colors.ContainsKey(id))
                {
                    receivedPointCloud.Colors.TryAdd(id, color);
                }
                else
                {
                    receivedPointCloud.Colors[id] = color;
                }
            }
        }
Пример #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ConcurrentPointCloud pointCloud = new ConcurrentPointCloud();

            DA.GetData(0, ref pointCloud);

            DA.SetDataList(0, pointCloud.Points.Values);
            DA.SetDataList(1, pointCloud.Colors.Values);
        }