public void RemovePlane(ARKitPlane planeInfo)
		{
			if (ActiveMode == StreamMode.WriteToDiskStream) {
				disk_writer.WriteLine("pr " + to_string(planeInfo));
			} else {
				currentFrame.RemovedPlanes.Add(planeInfo);
			}
		}
Example #2
0
        void read_ascii(string sPath)
        {
            char[] sep = { ' ' };

            using (StreamReader reader = new StreamReader(sPath)) {
                while (!reader.EndOfStream)
                {
                    string   sLine  = reader.ReadLine();
                    string[] tokens = sLine.Split(sep);

                    if (tokens[0] == "ff")
                    {
                        float   time   = float.Parse(tokens[2]);
                        Vector3 camPos = new Vector3(
                            float.Parse(tokens[4]), float.Parse(tokens[5]), float.Parse(tokens[6]));
                        Quaternion camOrientation = new Quaternion(
                            float.Parse(tokens[8]), float.Parse(tokens[9]), float.Parse(tokens[10]), float.Parse(tokens[11]));
                        BeginFrame(time, camPos, camOrientation);
                    }
                    else if (tokens[0] == "pt")
                    {
                        Vector3 pos = new Vector3(
                            float.Parse(tokens[2]), float.Parse(tokens[3]), float.Parse(tokens[4]));
                        Vector2 screenPos = new Vector2(
                            float.Parse(tokens[6]), float.Parse(tokens[7]));
                        Color color = new Color(
                            float.Parse(tokens[9]), float.Parse(tokens[10]), float.Parse(tokens[11]));
                        AppendSample(pos, screenPos, color);
                    }
                    else if (tokens[0] == "pa" || tokens[0] == "pu" || tokens[0] == "pr")
                    {
                        ARKitPlane plane = plane_from_string(tokens);
                        if (tokens[0] == "pa")
                        {
                            AddPlane(plane);
                        }
                        else if (tokens[0] == "pu")
                        {
                            UpdatePlane(plane);
                        }
                        else
                        {
                            RemovePlane(plane);
                        }
                    }
                }
            }
        }
Example #3
0
        ARKitPlane plane_from_string(string[] tokens)
        {
            ARKitPlane p = new ARKitPlane();

            p.identifier = tokens[2];
            p.position   = new Vector3(
                float.Parse(tokens[4]), float.Parse(tokens[5]), float.Parse(tokens[6]));
            p.orientation = new Quaternion(
                float.Parse(tokens[8]), float.Parse(tokens[9]), float.Parse(tokens[10]), float.Parse(tokens[11]));
            p.type   = (PlaneType)int.Parse(tokens[13]);
            p.center = new Vector3(
                float.Parse(tokens[15]), float.Parse(tokens[16]), float.Parse(tokens[17]));
            p.extents = new Vector3(
                float.Parse(tokens[19]), float.Parse(tokens[20]), float.Parse(tokens[21]));
            return(p);
        }
Example #4
0
 string to_string(ARKitPlane p)
 {
     return(string.Format("i {0} p {1} o {2} t {3} c {4} e {5} ", p.identifier, p.position, p.orientation,
                          (int)p.type, p.center, p.extents));
 }