You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
58 lines
1.2 KiB
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Joint.h"
|
|
#include "Components/StaticMeshComponent.h"
|
|
#include "Eigen/Dense"
|
|
#include "Link.generated.h"
|
|
|
|
using namespace Eigen;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
|
class PBDROBOTICS_API ULink : public UStaticMeshComponent
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
|
|
// Properties in World space
|
|
|
|
Vector3d Position;
|
|
Vector3d Velocity;
|
|
double Mass;
|
|
Quaterniond Orientation;
|
|
Vector3d AngularVelocity;
|
|
|
|
Vector3d Last_Position;
|
|
Quaterniond Last_Orientation;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
UJoint* PrevJoint;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
UJoint* NextJoint;
|
|
|
|
void Update(const double H);
|
|
void Integrate(const double H);
|
|
void UpdateInternalTransform();
|
|
|
|
// Inertia tensor in world space
|
|
Matrix3d GetInertia() const;
|
|
|
|
double GetPositionalInverseMass(const Vector3d R, const Vector3d N) const;
|
|
double GetRotationalInverseMass(const Vector3d N) const;
|
|
|
|
void Setup();
|
|
private:
|
|
UPROPERTY(EditAnywhere)
|
|
bool IsBase = false;
|
|
|
|
Matrix3d Inertia_Tensor_Local;
|
|
|
|
void SetupJoints() const;
|
|
void SetupProperties();
|
|
};
|
|
|