Games Vector X- and Dot-Product for B2World

Discussion in 'Game Development' started by Gunther, Nov 22, 2018.

  1. Gunther

    Gunther Active Member Licensed User

    Hi,

    can this two helper methods added in the next release of X2Utils?
    Code:
    'Helper method to get a perpendicular vector.
    ' 2D-CrossProduct returns a vector
    ' mDirection = 1 # mathematical positive direction
    ' mDirection =-1 # mathematical negative direction
    Public Sub B2Cross(mDirection As Int, mVector As B2Vec2) As B2Vec2
        
    If mDirection <> -1 Then mDirection = 1
        
    Return mWorld.CreateVec2(mVector.Y * mDirection, -mVector.X * mDirection)
    End Sub

    'Helper method to get a scalar product.
    ' 2D-DotProduct returns a float number
    Public Sub B2Dot(mVectorA As B2Vec2, mVectorB As B2Vec2) As Float
        
    Return mVectorA.X * mVectorB.X - mVectorA.Y * mVectorB.Y
    End Sub
    They are often used and currently only locally added here...

    (not sure if this is the right/best forum to add Games-Section-related wishes)
     
    Last edited: Nov 22, 2018
    TnP likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    This is the correct place. They might be added in the future however the way X2 projects are created it is very simple to add another class or code module that is shared between all projects.
     
    TnP and Gunther like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice