Skip to content

Dot product with theta argument bug #25

@Cvaniak

Description

@Cvaniak

There is two option to calculate dot product - only with vector argument and second option with vector and theta. There is line of code that calculate this:

return (self.magnitude() * vector.magnitude() * math.degrees(math.cos(theta)))

which gives wrong values. Result of third part should be between -1 and 1 (as cosinus values) and provided angle should be converted from degrees to radians so it should be like:

return self.magnitude() * vector.magnitude() * math.cos(math.radians(theta))

I created pull request with fix #26.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions