Skip to content

Possible bug in Quaternion #117

@SerafeimBakalakos

Description

@SerafeimBakalakos

In class ISAAR.MSolve.Numerical.LinearAlgebra.Quaternion methods ApplyIncrementalRotation(Vector incrementalRotation) and ApplyIncrementalRotationToNew(Vector incrementalRotation), note the segment:

        Vector updatedVectorPart = this.vectorPart;
        updatedVectorPart.Scale(scalarPartIncrement);
        updatedVectorPart.Add(scalarPart * vectorPartIncrement);
        Vector incrementCrossVectorPart = vectorPartIncrement ^ this.vectorPart;
        updatedVectorPart.Add(incrementCrossVectorPart);

The first line above does NOT copy the vector in C#. It only creates a new reference to the same vector. This means that as updatedVectorPart is scaled, added, etc, the original this.vectorPart does as well.

The question is: Is this code still correct, taking the above into consideration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions