// 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 CenterOfMass; Vector3d Position; Vector3d Velocity; double Mass; Quaterniond Orientation; Vector3d AngularVelocity; Matrix3d Inertia; 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 UpdateVisualTransform(); Matrix3d GetRotationMatrix() const; void Setup(); private: UPROPERTY(EditAnywhere) bool IsBase = false; Matrix3d Inertia_Tensor_Local; Matrix3d GetMomentOfInertia() const; void SetupJoints() const; void SetupProperties(); };