17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* 27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * you may not use this file except in compliance with the License. 67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * You may obtain a copy of the License at 77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software 117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * See the License for the specific language governing permissions and 147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * limitations under the License. 157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- includes ----------------------------------------------------------- */ 187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_TensorEm/Flt16Alt2D.h" 207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Math.h" 217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Memory.h" 227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Functions.h" 237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ auxiliary functions } ---------------------------------------- */ 297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ constructor / destructor } ----------------------------------- */ 377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bts_Flt16Alt2D_init( struct bts_Flt16Alt2D* ptrA ) 437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Mat2D_init( &ptrA->matE ); 457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Vec2D_init( &ptrA->vecE ); 467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bts_Flt16Alt2D_exit( struct bts_Flt16Alt2D* ptrA ) 517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Mat2D_exit( &ptrA->matE ); 537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Vec2D_exit( &ptrA->vecE ); 547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ operators } -------------------------------------------------- */ 617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bts_Flt16Alt2D_copy( struct bts_Flt16Alt2D* ptrA, const struct bts_Flt16Alt2D* srcPtrA ) 697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Mat2D_copy( &ptrA->matE, &srcPtrA->matE ); 717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Vec2D_copy( &ptrA->vecE, &srcPtrA->vecE ); 727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bts_Flt16Alt2D_equal( const struct bts_Flt16Alt2D* ptrA, const struct bts_Flt16Alt2D* srcPtrA ) 777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ! bts_Flt16Mat2D_equal( &ptrA->matE, &srcPtrA->matE ) ) return FALSE; 797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ! bts_Flt16Vec2D_equal( &ptrA->vecE, &srcPtrA->vecE ) ) return FALSE; 807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return TRUE; 817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ query functions } -------------------------------------------- */ 867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ modify functions } ------------------------------------------- */ 947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ I/O } -------------------------------------------------------- */ 1027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bts_Flt16Alt2D_memSize( struct bbs_Context* cpA, 1087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Alt2D *ptrA ) 1097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_ERROR0( "unimplemented function" ); 1117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return 0; 1127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bts_Flt16Alt2D_memWrite( struct bbs_Context* cpA, 1177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Alt2D* ptrA, 1187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint16* memPtrA ) 1197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_ERROR0( "unimplemented function" ); 1217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return 0; 1227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bts_Flt16Alt2D_memRead( struct bbs_Context* cpA, 1277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D* ptrA, 1287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const uint16* memPtrA ) 1297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( bbs_Context_error( cpA ) ) return 0; 1317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_ERROR0( "unimplemented function" ); 1327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return 0; 1337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ exec functions } --------------------------------------------- */ 1407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_createIdentity() 1467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL = { { 1, 0, 0, 1, 0 }, { 0, 0, 0 } }; 1487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 1497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_createRotation( phase16 angleA, 1547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Vec2D* centerPtrA ) 1557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 1577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.matE = bts_Flt16Mat2D_createRotation( angleA ); 1587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Vec2D_sub( *centerPtrA, bts_Flt16Mat2D_mapFlt( &altL.matE, centerPtrA ) ); 1597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 1607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_createScale( int32 scaleA, 1657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 scaleBbpA, 1667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Vec2D* centerPtrA ) 1677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 1697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.matE = bts_Flt16Mat2D_createScale( scaleA, scaleBbpA ); 1707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Vec2D_sub( *centerPtrA, bts_Flt16Mat2D_mapFlt( &altL.matE, centerPtrA ) ); 1717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 1727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_createRigid( phase16 angleA, 1777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 scaleA, 1787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 scaleBbpA, 1797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Vec2D* centerPtrA ) 1807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 1827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.matE = bts_Flt16Mat2D_createRigid( angleA, scaleA, scaleBbpA ); 1837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Vec2D_sub( *centerPtrA, bts_Flt16Mat2D_mapFlt( &altL.matE, centerPtrA ) ); 1847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 1857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_createRigidMap( struct bts_Flt16Vec2D vecIn1A, 1907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D vecIn2A, 1917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D vecOut1A, 1927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D vecOut2A ) 1937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D diffInL = bts_Flt16Vec2D_sub( vecIn1A, vecIn2A ); 1957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D diffOutL = bts_Flt16Vec2D_sub( vecOut1A, vecOut2A ); 1967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D centerInL = bts_Flt16Vec2D_mul( bts_Flt16Vec2D_add( vecIn1A, vecIn2A ), 1, 1 ); /* mul by 0.5 */ 1977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D centerOutL = bts_Flt16Vec2D_mul( bts_Flt16Vec2D_add( vecOut1A, vecOut2A ), 1, 1 ); /* mul by 0.5 */ 1987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Vec2D transL = bts_Flt16Vec2D_sub( centerOutL, centerInL ); 2007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project phase16 angleL = bts_Flt16Vec2D_enclosedAngle( &diffOutL, &diffInL ); 2017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 normInL = bts_Flt16Vec2D_norm( &diffInL ); 2027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 normOutL = bts_Flt16Vec2D_norm( &diffOutL ); 2037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 scaleL = ( normInL > 0 ) ? ( normOutL << 16 ) / normInL : 0xFFFFFFFF; 2057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 scaleBbpL = 16 + diffOutL.bbpE - diffInL.bbpE; 2067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 2087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* fit scale factor in 15 bit */ 2107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 scaleExpL = bbs_intLog2( scaleL ); 2117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( scaleExpL > 14 ) 2127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 2137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project scaleL >>= scaleExpL - 14; 2147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project scaleBbpL -= scaleExpL - 14; 2157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 2167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL = bts_Flt16Alt2D_createRigid( angleL, ( int16 )scaleL, scaleBbpL, ¢erInL ); 2187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Vec2D_add( altL.vecE, transL ); 2207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 2227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_create16( int16 xxA, 2277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 xyA, 2287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 yxA, 2297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 yyA, 2307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 matBbpA, 2317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 xA, 2327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 yA, 2337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int16 vecBbpA ) 2347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 2367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.matE = bts_Flt16Mat2D_create16( xxA, xyA, yxA, yyA, matBbpA ); 2377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Vec2D_create16( xA, yA, vecBbpA ); 2387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 2397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_create32( int32 xxA, 2447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 xyA, 2457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 yxA, 2467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 yyA, 2477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 matBbpA, 2487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 xA, 2497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 yA, 2507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 vecBbpA ) 2517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 2537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.matE = bts_Flt16Mat2D_create32( xxA, xyA, yxA, yyA, matBbpA ); 2547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Vec2D_create32( xA, yA, vecBbpA ); 2557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 2567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Vec2D bts_Flt16Alt2D_mapFlt( const struct bts_Flt16Alt2D* altPtrA, 2617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Vec2D* vecPtrA ) 2627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return bts_Flt16Vec2D_add( altPtrA->vecE, bts_Flt16Mat2D_mapFlt( &altPtrA->matE, vecPtrA ) ); 2647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_mul( const struct bts_Flt16Alt2D* alt1PtrA, 2697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Alt2D* alt2PtrA ) 2707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL; 2727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.vecE = bts_Flt16Alt2D_mapFlt( alt1PtrA, &alt2PtrA->vecE ); 2737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project altL.matE = bts_Flt16Mat2D_mul( &alt1PtrA->matE, &alt2PtrA->matE ); 2747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 2757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** multiplies matrix with matA; returns pointer to resulting matrix */ 2807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D* bts_Flt16Alt2D_mulTo( struct bts_Flt16Alt2D* alt1PtrA, 2817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Flt16Alt2D* alt2PtrA ) 2827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *alt1PtrA = bts_Flt16Alt2D_mul( alt1PtrA, alt2PtrA ); 2847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return alt1PtrA; 2857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bts_Flt16Alt2D_invert( struct bts_Flt16Alt2D* ptrA ) 2907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Mat2D_invert( &ptrA->matE ); 2927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->vecE = bts_Flt16Vec2D_create32( - ( ( ( int32 ) ptrA->matE.xxE * ptrA->vecE.xE + ( int32 ) ptrA->matE.xyE * ptrA->vecE.yE ) ), 2947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project - ( ( ( int32 ) ptrA->matE.yxE * ptrA->vecE.xE + ( int32 ) ptrA->matE.yyE * ptrA->vecE.yE ) ), 2957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->vecE.bbpE + ptrA->matE.bbpE ); 2967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bts_Flt16Alt2D bts_Flt16Alt2D_inverted( const struct bts_Flt16Alt2D* ptrA ) 3017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 3027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Flt16Alt2D altL = *ptrA; 3037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bts_Flt16Alt2D_invert( &altL ); 3047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return altL; 3057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 3067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 3087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 3107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 312