/** * This fills in the fields of the New proto based on the * fields of the Old proto. * * @param New new proto to be filled in * @param Old old proto to be converted * * Globals: none * * Exceptions: none * History: Mon Nov 26 09:45:39 1990, DSJ, Created. */ void MakeNewFromOld(PROTO New, PROTOTYPE *Old) { New->X = CenterX(Old->Mean); New->Y = CenterY(Old->Mean); New->Length = LengthOf(Old->Mean); New->Angle = OrientationOf(Old->Mean); FillABC(New); } /* MakeNewFromOld */
/*---------------------------------------------------------------------------*/ void ComputeMergedProto ( PROTO p1, PROTO p2, FLOAT32 w1, FLOAT32 w2, PROTO MergedProto) /* ** Parameters: ** p1, p2 protos to be merged ** w1, w2 weight of each proto ** MergedProto place to put resulting merged proto ** Globals: none ** Operation: This routine computes a proto which is the weighted ** average of protos p1 and p2. The new proto is returned ** in MergedProto. ** Return: none (results are returned in MergedProto) ** Exceptions: none ** History: Mon Nov 26 08:15:08 1990, DSJ, Created. */ { FLOAT32 TotalWeight; TotalWeight = w1 + w2; w1 /= TotalWeight; w2 /= TotalWeight; MergedProto->X = p1->X * w1 + p2->X * w2; MergedProto->Y = p1->Y * w1 + p2->Y * w2; MergedProto->Length = p1->Length * w1 + p2->Length * w2; MergedProto->Angle = p1->Angle * w1 + p2->Angle * w2; FillABC(MergedProto); } /* ComputeMergedProto */
/** * This routine computes a proto which is the weighted * average of protos p1 and p2. The new proto is returned * in MergedProto. * * @param p1, p2 protos to be merged * @param w1, w2 weight of each proto * @param MergedProto place to put resulting merged proto * * Globals: none * * @return none (results are returned in MergedProto) * @note Exceptions: none * @note History: Mon Nov 26 08:15:08 1990, DSJ, Created. */ void ComputeMergedProto (PROTO p1, PROTO p2, FLOAT32 w1, FLOAT32 w2, PROTO MergedProto) { FLOAT32 TotalWeight; TotalWeight = w1 + w2; w1 /= TotalWeight; w2 /= TotalWeight; MergedProto->X = p1->X * w1 + p2->X * w2; MergedProto->Y = p1->Y * w1 + p2->Y * w2; MergedProto->Length = p1->Length * w1 + p2->Length * w2; MergedProto->Angle = p1->Angle * w1 + p2->Angle * w2; FillABC(MergedProto); } /* ComputeMergedProto */
/*---------------------------------------------------------------------------*/ void MakeNewFromOld(PROTO New, PROTOTYPE *Old) { /* ** Parameters: ** New new proto to be filled in ** Old old proto to be converted ** Globals: none ** Operation: This fills in the fields of the New proto based on the ** fields of the Old proto. ** Return: none ** Exceptions: none ** History: Mon Nov 26 09:45:39 1990, DSJ, Created. */ New->X = CenterX(Old->Mean); New->Y = CenterY(Old->Mean); New->Length = LengthOf(Old->Mean); New->Angle = OrientationOf(Old->Mean); FillABC(New); } /* MakeNewFromOld */