public static bool TestOBBOBB(OBB obb1, OBB obb2)
        {
            var mink1 = Minkowski.Minkowskize_OBB_In_OBB(obb2, obb1);


            var x1width = obb1.HalfAxisWidth.X + mink1.HalfAxis.X;
            var y1width = obb1.HalfAxisWidth.Y + mink1.HalfAxis.Y;

            if (((Math.Abs(mink1.Position_LM.X) > x1width)
                 ||
                 (Math.Abs(mink1.Position_LM.Y) > y1width)))
            {
                return(false
                       );
            }
            else
            {
                var mink2 = Minkowski.Minkowskize_OBB_In_OBB(obb1, obb2);


                var x2width = obb2.HalfAxisWidth.X + mink2.HalfAxis.X;
                var y2width = obb2.HalfAxisWidth.Y + mink2.HalfAxis.Y;

                return(!(((Math.Abs(mink2.Position_LM.X) > x2width)
                          ||
                          (Math.Abs(mink2.Position_LM.Y) > y2width))));
            }
        }
        //***************************************************
        //INTERSECTIONS



        public static bool IntersectOBBOBB(OBB obb1, OBB obb2, ref Geometry.Geometric_Queries.Distance_Query_Result result)
        {
            var mink2 = Minkowski.Minkowskize_OBB_In_OBB(obb2, obb1);
            var mink1 = Minkowski.Minkowskize_OBB_In_OBB(obb1, obb2);

            var dist_of_2_from_1 = obb1.What_Faces(mink2);

            var dist_of_1_from_2 = obb2.What_Faces(mink1);

            if (Math.Max(dist_of_1_from_2.Signed_Dist, dist_of_2_from_1.Signed_Dist) > 0)
            {
                return(false);
            }

            Minkowski_Description mink;
            Facing_Point_Result   data;

            //pernoume os normal owning afto pou exei to allo pio exo
            bool normal_owning_first = dist_of_2_from_1.Signed_Dist > dist_of_1_from_2.Signed_Dist;

            var normal_owning_obb = (normal_owning_first) ? obb1 : obb2;
            var selected_obb      = (!normal_owning_first) ? obb1 : obb2;

            mink = (normal_owning_first) ? mink2 : mink1;

            data = (normal_owning_first) ? dist_of_2_from_1 : dist_of_1_from_2;



            Vector3 p0; Vector3 p1; float d_0, d_1;
            var     normal = normal_owning_obb.Normal(data.Normal_Code);

            OBB.Extraction_of_inner_contact_points2(normal_owning_obb, selected_obb, normal,
                                                    data.Normal_Code, out p0, out p1, out d_0, out d_1);



            var test = p0 - p1;



            result = new Geometry.Geometric_Queries.Distance_Query_Result();

            result.first_has_normal = normal_owning_first;
            result.Normal_W         = normal;

            result.signed_distance = normal_owning_first ? dist_of_2_from_1.Signed_Dist : dist_of_1_from_2.Signed_Dist;


            result.double_contact = (Math.Abs(d_1 - d_0) < 0.3f);


            GELib.Debug.Debug_Drawing.double_edge = result.double_contact;

            result.Point_W_0 = p0;
            result.Point_W_1 = p1;

            return(true);
        }
        public static bool IntersectOBBTriangle(OBB obb, Triangle trig, ref Geometry.Geometric_Queries.Distance_Query_Result result)
        {
            var minked_tri = Minkowski.Minkowskize_Triangle_In_OBB(trig, obb);
            var minked_obb = Minkowski.Minkowskize_OBB_In_Triangle(obb, trig);


            var tr_from_obb = obb.What_Faces(minked_tri);

            var obb_from_tr = trig.What_Faces(minked_obb);

            if (Math.Max(tr_from_obb.Signed_Dist, obb_from_tr.Signed_Dist) > 0.0f)
            {
                return(false);
            }


            //pernoume os normal owning afto pou exei to allo pio exo
            bool normal_owning_tr = obb_from_tr.Signed_Dist > tr_from_obb.Signed_Dist;



            if (normal_owning_tr)
            {
                result = new Geometry.Geometric_Queries.Distance_Query_Result();
                result.first_has_normal = !normal_owning_tr;
                result.Normal_W         = trig.Normals[obb_from_tr.Normal_Code];
                var Extreme_Point_In_Normal_Of_Body_1 = trig.Points[obb_from_tr.Normal_Code] - Intersection_Grid.current_pair_element_2.Rigid.Position;
                var Extreme_Point_In_Normal_Of_Body_2 = obb.Vertex(obb.Extreme_In(-result.Normal_W).code) - obb.Position;


                result.signed_distance = obb_from_tr.Signed_Dist;
                result.double_contact  = false;
                result.Point_W_0       = Extreme_Point_In_Normal_Of_Body_2 + obb.Position;
            }
            else
            {
                result = new Geometry.Geometric_Queries.Distance_Query_Result();
                result.first_has_normal = !normal_owning_tr;
                result.Normal_W         = obb.Normal(tr_from_obb.Normal_Code);
                var Extreme_Point_In_Normal_Of_Body_1 = obb.Vertex(tr_from_obb.Normal_Code) - obb.parent_tmp.Position;
                var Extreme_Point_In_Normal_Of_Body_2 = trig.Points[(trig.Extreme_In(-result.Normal_W).code)] - Intersection_Grid.current_pair_element_2.Rigid.Position;

                result.signed_distance = tr_from_obb.Signed_Dist;
                result.Point_W_0       = Extreme_Point_In_Normal_Of_Body_2 + Intersection_Grid.current_pair_element_2.Rigid.Position;
            }
            return(true);
        }