<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Box2D.Common;

namespace Box2D.Collision.Shapes
{
    public class b2ChainShape : b2Shape
    {
        /// The vertices. Owned by this class.
        protected b2Vec2[] m_vertices;
        public b2Vec2[] Vertices
        {
            get { return (m_vertices); }
            set { m_vertices = value; }
        }
        /// The vertex count.
        protected int m_count;
        public int Count
        {
            get { return (m_count); }
            set { m_count = value; }
        }
        protected b2Vec2 m_PrevVertex = b2Vec2.Zero;
        public b2Vec2 PrevVertex
        {
            get { return (m_PrevVertex); }
            set { m_PrevVertex = value; }
        }

        protected b2Vec2 m_NextVertex = b2Vec2.Zero;
        public b2Vec2 NextVertex
        {
            get { return (m_NextVertex); }
            set { m_NextVertex = value; }
        }
        protected bool m_hasPrevVertex, m_hasNextVertex;
        public bool HasPrevVertex
        {
            get { return (m_hasPrevVertex); }
            set { m_hasPrevVertex = value; }
        }
        public bool HasNextVertex
        {
            get { return (m_hasNextVertex); }
            set { m_hasNextVertex = value; }
        }

        public b2ChainShape()
        {
            m_type = b2ShapeType.e_chain;
            m_radius = b2Settings.b2_polygonRadius;
            m_vertices = null;
            m_count = 0;
            m_hasPrevVertex = false;
            m_hasNextVertex = false;
        }


        public virtual void CreateLoop(b2Vec2[] vertices, int count)
        {
            m_count = count + 1;
            m_vertices = new b2Vec2[m_count];
            Array.Copy(vertices, m_vertices, count);
            m_vertices[count] = m_vertices[0];
            PrevVertex = m_vertices[m_count - 2];
            NextVertex = m_vertices[1];
            m_hasPrevVertex = true;
            m_hasNextVertex = true;
        }

        public virtual void CreateChain(b2Vec2[] vertices, int count)
        {
            m_count = count;
            m_vertices = new b2Vec2[count];
            Array.Copy(m_vertices, vertices, count);<commit_msg>box2d: fixed bug in copying ChainShape<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Box2D.Common;

namespace Box2D.Collision.Shapes
{
    public class b2ChainShape : b2Shape
    {
        /// The vertices. Owned by this class.
        protected b2Vec2[] m_vertices;
        public b2Vec2[] Vertices
        {
            get { return (m_vertices); }
            set { m_vertices = value; }
        }
        /// The vertex count.
        protected int m_count;
        public int Count
        {
            get { return (m_count); }
            set { m_count = value; }
        }
        protected b2Vec2 m_PrevVertex = b2Vec2.Zero;
        public b2Vec2 PrevVertex
        {
            get { return (m_PrevVertex); }
            set { m_PrevVertex = value; }
        }

        protected b2Vec2 m_NextVertex = b2Vec2.Zero;
        public b2Vec2 NextVertex
        {
            get { return (m_NextVertex); }
            set { m_NextVertex = value; }
        }
        protected bool m_hasPrevVertex, m_hasNextVertex;
        public bool HasPrevVertex
        {
            get { return (m_hasPrevVertex); }
            set { m_hasPrevVertex = value; }
        }
        public bool HasNextVertex
        {
            get { return (m_hasNextVertex); }
            set { m_hasNextVertex = value; }
        }

        public b2ChainShape()
        {
            m_type = b2ShapeType.e_chain;
            m_radius = b2Settings.b2_polygonRadius;
            m_vertices = null;
            m_count = 0;
            m_hasPrevVertex = false;
            m_hasNextVertex = false;
        }


        public virtual void CreateLoop(b2Vec2[] vertices, int count)
        {
            m_count = count + 1;
            m_vertices = new b2Vec2[m_count];
            Array.Copy(vertices, m_vertices, count);
            m_vertices[count] = m_vertices[0];
            PrevVertex = m_vertices[m_count - 2];
            NextVertex = m_vertices[1];
            m_hasPrevVertex = true;
            m_hasNextVertex = true;
        }

        public virtual void CreateChain(b2Vec2[] vertices, int count)
        {
            m_count = count;
            m_vertices = new b2Vec2[count];
            Array.Copy(vertices, m_vertices, count);
{'fraction_non_alphanumeric': 0.08074807480748075, 'fraction_numerical': 0.0165016501650165, 'mean_word_length': 1.5977142857142856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7134897', 'n_tokens_mistral': 1364, 'n_tokens_neox': 1346, 'n_words': 310}