00001 /*-----------------------------------------------------------------------* 00002 Project: Nintendo Augmented Reality Library. 00003 File: narEdgeLine.h 00004 00005 Copyright (C)2011-2012 Nintendo Co., Ltd. All rights reserved. 00006 00007 These coded instructions, statements, and computer programs contain 00008 proprietary information of Nintendo and/or its licensed developers 00009 and are protected by national and international copyright laws. They 00010 may not be disclosed to third parties or copied or duplicated in any 00011 form, in whole or in part, without the prior written consent of 00012 Nintendo. 00013 The content herein is highly confidential and should be handled 00014 accordingly. 00015 *-----------------------------------------------------------------------*/ 00016 00018 00022 #ifndef NAR_MESH_LINE_H__ 00023 #define NAR_MESH_LINE_H__ 00024 00025 #include "narVec2.h" 00026 00027 namespace mw { namespace nar 00028 { 00032 class MeshLine_cl 00033 { 00034 public: 00035 MeshLine_cl() 00036 { 00037 } 00038 00041 void SetStart( f32 x, f32 y ) 00042 { 00043 m_Start.Set( x, y ); 00044 } 00045 00048 void SetStart( const Vec2F_st & cr ) 00049 { 00050 SetStart( cr.X(), cr.Y() ); 00051 } 00052 00055 void SetEnd( f32 x, f32 y ) 00056 { 00057 m_End.Set( x, y ); 00058 } 00059 00062 void SetEnd( const Vec2F_st & cr ) 00063 { 00064 SetEnd( cr.X(), cr.Y() ); 00065 } 00066 00069 bool GetIntersection( Vec2F_st * p_Point, const MeshLine_cl & r_Edge ) const; 00070 00071 f32 GetA() const { return m_A; } 00072 f32 GetB() const { return m_B; } 00073 f32 GetC() const { return m_C; } 00074 00077 s32 GetSquareLength() const 00078 { 00079 return GetrStart().GetSquareDistance( GetrEnd() ); 00080 } 00081 00084 bool CalcEquation(); 00085 00089 f32 GetDistance( const Vec2F_st &r ) const; 00090 00094 f32 GetDistance( const Vec2I_st &r ) const; 00095 00096 private: 00098 f32 m_A; 00100 f32 m_B; 00102 f32 m_C; 00103 00104 Vec2F_st m_Start; 00105 Vec2F_st m_End; 00106 00107 const Vec2F_st & GetrStart() const { return m_Start; } 00108 const Vec2F_st & GetrEnd() const { return m_End; } 00109 }; 00110 } 00111 } 00112 #endif 00113
© 2011-2012 Nintendo. All rights reserved.
CONFIDENTIAL