News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Overlaped Triangle

Started by Farabi, April 09, 2014, 07:31:38 PM

Previous topic - Next topic

Farabi



I cant stop thinking about this. Anyone had information on how to calculate an overlaped triangle? I already know how to calculcate an intersected triangle but not an overlaped one. Thanks for any info. This is the 3rd day I dont have enough sleep thinking about this. Im so curious.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

Siekmanski

Calculate the average z value of the three points per triangle.
Don't use the z-buffer.
Sort the triangles by the average z values and draw them from back to front.
Creative coders use backward thinking techniques as a strategy.

Farabi

Quote from: Siekmanski on April 09, 2014, 08:51:37 PM
Calculate the average z value of the three points per triangle.
Don't use the z-buffer.
Sort the triangles by the average z values and draw them from back to front.

Hi siekmansie.
No it was not a renderer problem its a collission detect problem. Im trying to create a physic engine. But thanks for your attention.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

Farabi

Anyone knew who is the first person who invent this formula?

private bool PointInTriangle(Vector3[] TriangleVectors, Vector3 P)
    {
        Vector3 A = TriangleVectors[0], B = TriangleVectors[1], C = TriangleVectors[2];
        if (SameSide(P, A, B, C) && SameSide(P, B, A, C) && SameSide(P, C, A, B))
        {
            Vector3 vc1 = Vector3.Cross(Vector3.Subtract(A, B), Vector3.Subtract(A, C));
            if (Math.Abs(Vector3.Dot(Vector3.Subtract(A, P), vc1)) <= .01f)
                return true;
        }

        return false;
    }

    private bool SameSide(Vector3 p1, Vector3 p2, Vector3 A, Vector3 B)
    {
        Vector3 cp1 = Vector3.Cross(Vector3.Subtract(B, A), Vector3.Subtract(p1, A));
        Vector3 cp2 = Vector3.Cross(Vector3.Subtract(B, A), Vector3.Subtract(p2, A));
        if (Vector3.Dot(cp1, cp2) >= 0) return true;
        return false;

    }


I think 3D technology is only the past 40 years, but it amazingly fast. The discovery of the 3D math is superb. I think it took 3 century before we can enhance pytagoras formula, but then 3D formula suddenly appear. Anyone maybe know how this is invented? How did they discover it and they did the research? I wanted to understand their paradigm.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165