getRayIntersection() private méthode

private getRayIntersection ( Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 &intersection ) : bool
a Microsoft.Xna.Framework.Vector2
b Microsoft.Xna.Framework.Vector2
c Microsoft.Xna.Framework.Vector2
d Microsoft.Xna.Framework.Vector2
intersection Microsoft.Xna.Framework.Vector2
Résultat bool
Exemple #1
0
        void patchJaggedJoint(ref Segment segment, ref int vertIndex)
        {
            Vector2 intersection;

            if (segment.shouldFuseBottom)
            {
                if (Vector2Ext.getRayIntersection(
                        segment.tl,
                        segment.tr,
                        _lastSegment.tl,
                        _lastSegment.tr,
                        out intersection))
                {
                    addVert(vertIndex++, intersection, new Vector2(1, 1), segment.point.color);

                    _indices.add((short)vertIndex);
                    _indices.add((short)(vertIndex + 4));
                    _indices.add((short)(vertIndex - 1));

                    _indices.add((short)(vertIndex - 1));
                    _indices.add((short)(vertIndex + 4));
                    _indices.add((short)(vertIndex - 5));
                }
            }
            else
            {
                if (Vector2Ext.getRayIntersection(
                        segment.bl,
                        segment.br,
                        _lastSegment.bl,
                        _lastSegment.br,
                        out intersection))
                {
                    var firstSegmentOffset = vertIndex == 5 ? 1 : 0;
                    addVert(vertIndex++, intersection, new Vector2(1, 0), segment.point.color);

                    _indices.add((short)(vertIndex + 4));
                    _indices.add((short)(vertIndex + 3));
                    _indices.add((short)(vertIndex - 1));

                    _indices.add((short)(vertIndex - 3 + firstSegmentOffset));
                    _indices.add((short)(vertIndex + 4));
                    _indices.add((short)(vertIndex - 1));
                }
            }
        }