/**************************************************************************** * Copyright 2019 Nreal Techonology Limited. All rights reserved. * * This file is part of NRSDK. * * https://www.nreal.ai/ * *****************************************************************************/ namespace NRKernal { using System; using UnityEngine; /// A trackable image in the real world detected by NRInternel. public class NRTrackableImage : NRTrackable { internal NRTrackableImageSubsystem TrackableImageSubsystem { get { return NRSessionManager.Instance.TrackableFactory.TrackableImageSubsystem; } } /// Constructor. /// Handle of the native. /// The native interface. internal NRTrackableImage(UInt64 nativeHandle) : base(nativeHandle) { } /// /// Gets the position and orientation of the marker's center in Unity world space. /// The center pose. public override Pose GetCenterPose() { if (NRFrame.SessionStatus != SessionState.Running) { return Pose.identity; } var native_pose = TrackableImageSubsystem.GetCenterPose(TrackableNativeHandle); return ConversionUtility.ApiWorldToUnityWorld(native_pose); } /// Gets the width of marker. /// The extent x coordinate. public float ExtentX { get { return Size.x; } } /// Gets the height of marker. /// The extent z coordinate. public float ExtentZ { get { return Size.y; } } /// Get the size of trackable image. size of trackable imag(width、height). /// The size. public Vector2 Size { get { if (NRFrame.SessionStatus != SessionState.Running) { return Vector2.zero; } return TrackableImageSubsystem.GetSize(TrackableNativeHandle); } } } }