1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef bts_INT16VEC3D_EM_H
18 #define bts_INT16VEC3D_EM_H
19 
20 /* ---- includes ----------------------------------------------------------- */
21 
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/Basic.h"
24 
25 /* ---- related objects  --------------------------------------------------- */
26 
27 /* ---- typedefs ----------------------------------------------------------- */
28 
29 /* ---- constants ---------------------------------------------------------- */
30 
31 /* ---- object definition -------------------------------------------------- */
32 
33 /** 3d vector */
34 struct bts_Int16Vec3D
35 {
36 
37 	/* ---- private data --------------------------------------------------- */
38 
39 	/* ---- public data ---------------------------------------------------- */
40 
41 	/** x component */
42 	int16 xE;
43 
44 	/** y component */
45 	int16 yE;
46 
47 	/** z component */
48 	int16 zE;
49 };
50 
51 /* ---- associated objects ------------------------------------------------- */
52 
53 /* ---- external functions ------------------------------------------------- */
54 
55 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
56 
57 /* ---- \ghd{ operators } -------------------------------------------------- */
58 
59 /* ---- \ghd{ query functions } -------------------------------------------- */
60 
61 /* ---- \ghd{ modify functions } ------------------------------------------- */
62 
63 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
64 
65 /** size object needs when written to memory */
66 uint32 bts_Int16Vec3D_memSize( struct bbs_Context* cpA,
67 							   const struct bts_Int16Vec3D* ptrA );
68 
69 /** writes object to memory; returns number of bytes written */
70 uint32 bts_Int16Vec3D_memWrite( struct bbs_Context* cpA,
71 							    const struct bts_Int16Vec3D* ptrA,
72 								uint16* memPtrA );
73 
74 /** reads object from memory; returns number of bytes read */
75 uint32 bts_Int16Vec3D_memRead( struct bbs_Context* cpA,
76 							   struct bts_Int16Vec3D* ptrA,
77 							   const uint16* memPtrA );
78 
79 /* ---- \ghd{ exec functions } --------------------------------------------- */
80 
81 /** returns square norm of vector */
82 uint32 bts_Int16Vec3D_norm2( const struct bts_Int16Vec3D* ptrA );
83 
84 /** returns norm of vector */
85 uint16 bts_Int16Vec3D_norm( const struct bts_Int16Vec3D* ptrA );
86 
87 /** normalizes vector; bbpA defines number of bits behind the point */
88 void bts_Int16Vec3D_normalize( struct bts_Int16Vec3D* ptrA, int32 bbpA );
89 
90 /** returns normalized vector; bbpA defines number of bits behind the point */
91 struct bts_Int16Vec3D bts_Int16Vec3D_normalized( const struct bts_Int16Vec3D* ptrA, int32 bbpA );
92 
93 #endif /* bts_INT16VEC3D_EM_H */
94 
95