LogError() публичный статический Метод

Logs an error with a stack trace.
public static LogError ( object message ) : void
message object The error message.
Результат void
Пример #1
0
        /// <summary>
        /// Check if a ray hit point with the point cloud.
        /// </summary>
        /// <param name="ray">A ray start from tracked position.</param>
        /// <param name="pointcloud">A point cloud to hit aginst.</param>
        /// <param name="hitPoint">The hit point's position.</param>
        private static bool _IsRayIntersectingPoint(Ray ray, PointCloud pointcloud, ref Vector3 hitPoint)
        {
            int pointcloudCount = pointcloud.PointCount;

            if (pointcloudCount == 0)
            {
                ARDebug.LogError("point cloud count is zero");
                return(false);
            }

            float min          = float.MaxValue;
            bool  isPointFound = false;

            for (int i = 0; i < pointcloudCount; ++i)
            {
                Vector3 point = pointcloud.GetPoint(i);
                Vector3 v0    = point - ray.origin;
                Vector3 v1    = ray.direction;
                float   angle = Vector3.Angle(v0, v1);

                const float TOUCH_SEARCH_ANGLE_DEGREE = 5.0f;

                if (angle < TOUCH_SEARCH_ANGLE_DEGREE && angle < min)
                {
                    isPointFound = true;
                    hitPoint     = point;
                }
            }
            return(isPointFound);
        }
Пример #2
0
        public bool GetAllCameraMetadataTags(
            IntPtr cameraMetadataHandle, List <CameraMetadataTag> resultList)
        {
            if (InstantPreviewManager.IsProvidingPlatform)
            {
                InstantPreviewManager.LogLimitedSupportMessage("access camera metadata tags");
                return(false);
            }

            IntPtr tagsHandle = IntPtr.Zero;
            int    tagsCount  = 0;

            ExternApi.ArImageMetadata_getAllKeys(
                _nativeSession.SessionHandle, cameraMetadataHandle, ref tagsCount, ref tagsHandle);
            if (tagsCount == 0 || tagsHandle == IntPtr.Zero)
            {
                ARDebug.LogError(
                    "ArImageMetadata_getAllKeys error with empty metadata keys list.");
                return(false);
            }

            for (int i = 0; i < tagsCount; i++)
            {
                resultList.Add((CameraMetadataTag)Marshal.PtrToStructure(
                                   MarshalingHelper.GetPtrToUnmanagedArrayElement <int>(tagsHandle, i),
                                   typeof(int)));
            }

            return(true);
        }
        public static FeaturePointOrientationMode ToFeaturePointOrientationMode(
            this ApiFeaturePointOrientationMode apiMode)
        {
            switch (apiMode)
            {
            case ApiFeaturePointOrientationMode.Identity:
                return(FeaturePointOrientationMode.Identity);

            case ApiFeaturePointOrientationMode.SurfaceNormal:
                return(FeaturePointOrientationMode.SurfaceNormal);

            default:
                ARDebug.LogError("Invalid value for ApiFeaturePointOrientationMode.");
                return(FeaturePointOrientationMode.Identity);
            }
        }
Пример #4
0
        private void _UpdatePlanes(List <ApiPlaneData> latestPlaneData, List <TrackedPlaneRecord> newPlaneRecords,
                                   List <TrackedPlaneRecord> planeRecords, bool forceUpdate)
        {
            // Add latest planedata to a convenient hash on ID (note: not hashing plane itself to avoid potential boxing
            // of the struct on comparison overloads).
            m_tmpLastestPlanesHash.Clear();
            for (int i = 0; i < latestPlaneData.Count; i++)
            {
                m_tmpLastestPlanesHash.Add(latestPlaneData[i].id);
            }

            // Create or update all planes that appear in latestPlaneData.
            newPlaneRecords.Clear();
            for (int i = 0; i < latestPlaneData.Count; i++)
            {
                int planeRecordIndex = _FindPlaneRecordById(latestPlaneData[i].id, planeRecords);
                if (planeRecordIndex != -1)
                {
                    planeRecords[planeRecordIndex] = new TrackedPlaneRecord(planeRecords[planeRecordIndex].m_plane,
                                                                            latestPlaneData[i], planeRecords[planeRecordIndex].m_updatePlane);
                    planeRecords[planeRecordIndex].m_updatePlane(latestPlaneData[i], null, forceUpdate);
                }
                else
                {
                    Action <ApiPlaneData, TrackedPlane, bool> updatePlane;
                    var trackedPlane = new TrackedPlane(latestPlaneData[i], out updatePlane);
                    newPlaneRecords.Add(new TrackedPlaneRecord(trackedPlane, latestPlaneData[i], updatePlane));
                }
            }

            // Add new planes into plane records
            for (int i = 0; i < newPlaneRecords.Count; i++)
            {
                planeRecords.Add(newPlaneRecords[i]);
            }

            // Invalidate planes that were previously tracking but not present in latestPlaneData.  Delete planes that
            // are invalid or subsumed.
            for (int i = planeRecords.Count - 1; i >= 0; i--)
            {
                if (!m_tmpLastestPlanesHash.Contains(planeRecords[i].m_planeData.id))
                {
                    ApiPlaneData invalidPlane = new ApiPlaneData();
                    invalidPlane.id = planeRecords[i].m_planeData.id;
                    planeRecords[i].m_updatePlane(invalidPlane, null, true);
                    planeRecords.RemoveAt(i);
                }
                else if (planeRecords[i].m_planeData.subsumedBy > -1)
                {
                    int subsumerIndex = _FindPlaneRecordById(planeRecords[i].m_planeData.subsumedBy, planeRecords);
                    if (subsumerIndex == -1)
                    {
                        ARDebug.LogError("Failed to find a record of the subsuming plane.");
                        continue;
                    }

                    planeRecords[i].m_updatePlane(planeRecords[i].m_planeData, planeRecords[subsumerIndex].m_plane,
                                                  true);
                    planeRecords.RemoveAt(i);
                }
            }
        }