Пример #1
0
GEOM geom_3v_onto_3v(VECTOR v1, VECTOR v2, VECTOR v3, VECTOR t1, VECTOR t2, VECTOR t3)
{  GEOM op;
   float angle;
   LINE axis;
   VECTOR v123;
   PLANE plane_v123, plane_t123;

   /* step 1, superimpose v1 to t1 */
   geom_reset(&op);
   geom_move(&op, vector_vminusv(t1, v1));

   /* step 2, align v1-v2 to t1-t2 */
   angle = all(line_2v(v1, v2), line_2v(t1, t2));
   axis.p0 = t1;
   axis.t  = vector_normalize(vector_vxv(vector_vminusv(v2, v1), vector_vminusv(t2, t1)));
   geom_roll(&op, angle, axis);

   /* normal direction of plane v123 should be updated */
   geom_apply(op, &v1);
   geom_apply(op, &v2);
   geom_apply(op, &v3);
   plane_v123 = plane_3v(v1, v2, v3);
   plane_t123 = plane_3v(t1, t2, t3);
   v123 = plane_v123.t;

   /*step 3, align v1-v2-v3 to t1-t2-t3 */
   angle = avv(v123, plane_t123.t);
   axis.p0 = t1;
   axis.t  = vector_normalize(vector_vxv(v123, plane_t123.t));
   geom_roll(&op, angle, axis);

   return op;
}
void ValueReader::fromBSONArray(const BSONObj& obj, const BSONObj* parent, bool readOnly) {
    JS::AutoValueVector avv(_context);

    BSONForEach(elem, obj) {
        JS::RootedValue member(_context);

        ValueReader(_context, &member).fromBSONElement(elem, parent ? *parent : obj, readOnly);
        if (!avv.append(member)) {
            uasserted(ErrorCodes::JSInterpreterFailure, "Failed to append to JS array");
        }
    }
Пример #3
0
float all(LINE line1, LINE line2)
{  return avv(line1.t, line2.t);
}
Пример #4
0
float app(PLANE plane1, PLANE plane2)
{  return avv(plane1.t, plane2.t);
}