Files
Plugin/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGNovaGloveCalibrationImpl.cpp
T

91 lines
4.0 KiB
C++

/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2022 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGCoreImpl/SGNovaGloveCalibrationImpl.h"
#include "SGBuildHacks/SGInclude_Core_NovaGloveCalibration.h"
#include "SGBuildHacks/SGInclude_Core_Vect3D.h"
#include "SGCoreImpl/SGNovaGloveHandProfileImpl.h"
#include "SGCoreImpl/SGVect3DImpl.h"
#include "SGUtils/SGArrayUtils.h"
void FSGNovaGloveCalibrationImpl::ApplyDefaultCalibrationInterpolationValues(const TArray<FVector>& RetractedValues,
const TArray<FVector>& ExtendedValues,
const FSGNovaGloveHandProfileImpl& Profile)
{
std::vector<FSGVect3DImpl::FVect3DType> RetractedValuesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
RetractedValues)
};
std::vector<FSGVect3DImpl::FVect3DType> ExtendedValuesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
ExtendedValues)
};
FNovaGloveCalibrationType::ApplyDefaultCalibrationInterpolationValues(
MoveTemp(RetractedValuesVector), MoveTemp(ExtendedValuesVector),
Profile.ToNovaGloveHandProfile());
}
void FSGNovaGloveCalibrationImpl::ApplyInterpolationValues(const TArray<FVector>& RetractedValues,
const TArray<FVector>& ExtendedValues,
const TArray<TArray<FVector>>& RetractedAngles,
const TArray<TArray<FVector>>& ExtendedAngles,
const FSGNovaGloveHandProfileImpl& Profile)
{
std::vector<FSGVect3DImpl::FVect3DType> RetractedValuesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
RetractedValues)
};
std::vector<FSGVect3DImpl::FVect3DType> ExtendedValuesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
ExtendedValues)
};
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> RetractedAnglesVector{
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(RetractedAngles)
};
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> ExtendedAnglesVector{
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(ExtendedAngles)
};
FNovaGloveCalibrationType::ApplyInterpolationValues(
MoveTemp(RetractedValuesVector), MoveTemp(ExtendedValuesVector),
MoveTemp(RetractedAnglesVector), MoveTemp(ExtendedAnglesVector),
Profile.ToNovaGloveHandProfile());
}