コード例 #1
0
ファイル: scene_editing.cpp プロジェクト: trtikm/E2
vector3  scene_nodes_translation_data::get_shift(vector3 const&  new_plane_point)
{
    if (!is_plain_point_valid())
    {
        set_plain_point(new_plane_point);
        return vector3_zero();
    }
    vector3  shift = new_plane_point - m_plain_point;
    set_plain_point(new_plane_point);
    return reduce_shift_vector(shift);
}
コード例 #2
0
ファイル: vector3.c プロジェクト: ericyao2013/hypatia
/**
 * @brief Multiply a vector by a matrix, returns a vector
 *
 * @param self The vector being multiplied
 * @param mT The matrix used to do the multiplication
 */
HYPAPI vector3 * vector3_multiplym4(vector3 *self, const matrix4 *mT)
{
	vector3 vR;
	
	vector3_zero(&vR);
	
	vR.x = self->x * mT->c00 + self->y * mT->c01 + self->z * mT->c02 + mT->c03;
	vR.y = self->x * mT->c10 + self->y * mT->c11 + self->z * mT->c12 + mT->c13;
	vR.z = self->x * mT->c20 + self->y * mT->c21 + self->z * mT->c22 + mT->c23;
	
	vector3_set(self, &vR);
	
	return self;
}