VelcroPhysics icon indicating copy to clipboard operation
VelcroPhysics copied to clipboard

Some suggestions on the naming of elements

Open experdot opened this issue 7 years ago • 1 comments

VelcroPhysics.Dynamics.Body

_xf is strange and it may be abbreviation of XForm which is similiar to Transform .In addition,variable names beginning with an underscore is not compliant with the CLS.

    public class Body
    {
        public Transform _xf; // the body origin transform
    }

Suggest :

    public class Body
    {
        public Transform Transform; // the body origin transform
    }

VelcroPhysics.Dynamics.TimeStep

In general,a public variable should be full word.

    public struct TimeStep
    {
        public float dt;
        public float dtRatio;
        public float inv_dt;
    }

Suggest :

    public struct TimeStep
    {
        public float DeltaTime;
        public float DeltaTimeRatio;
        public float InverseDeltaTime;
    }

VelcroPhysics.Shared.Rot

Rot doesn't name with a full noun,and fields s,c lead to confusion.

    public struct Rot
    {
        public float s,c;
    }

Suggest:

    public struct Rotation
    {
        public float SinValue;
        public float CosValue;
    }

VelcroPhysics.Shared.Transform

Likewise,the meanings of p and q are not clearly.

    public struct Transform
    {
        public Vector2 p;
        public Rot q;
    }

Suggest :

    public struct Transform
    {
        public Vector2 Position;
        public Rotation Rotation;
    }

experdot avatar Aug 10 '17 10:08 experdot

You are right. The naming comes from Box2D for the most part. The transform on the body is temporary to have the build in source control compile, nothing else. I will rename things correctly when I get some time to work on the engine.

Genbox avatar Aug 11 '17 16:08 Genbox