Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Cannot perform cross product on 3D vectors #6

Open
dbecker59 opened this issue Dec 7, 2023 · 1 comment
Open

Cannot perform cross product on 3D vectors #6

dbecker59 opened this issue Dec 7, 2023 · 1 comment

Comments

@dbecker59
Copy link

I'm about to start a project that'll need eigen and this was the only library that even remotely worked, but I've found that the 3D cros product doesn't work. Here's an example sketch:

`/*
Name: Arduino_Device_Application.ino
Created: 12/7/2023 3:15:25 AM
Author: danie
*/

// the setup function runs once when you press reset or power the board

#include <EigenAVR.h>
#include <Eigen30.h>

void setup() {
Serial.begin(115200);
}

// the loop function runs over and over again until power down or reset
void loop() {
Serial.print("\n Length: ");
Serial.print(Eigen::Vector3f({ 1, 0, 0 }).cross(Eigen::Vector3f({ 0, 1, 0 }))(2));
delay(1000);
}`

which when I build, gives the following output

`Compiling 'Arduino_Device_Application' for 'Arduino Due (Programming Port) (arduino_due_x_dbg)'
Build Folder: "file:///C:/Users/******/AppData/Local/Temp/VMBuilds/Arduino_Device_Application/arduino_due_x_dbg/Release"

Arduino_Device_Application.cpp.o: In function loop

Error linking for board Arduino Due (Programming Port) (arduino_due_x_dbg)
Build failed for project 'Arduino_Device_Application'
Arduino_Device_Application.ino:19: undefined reference to Eigen Matrix<float, 3, 1, 0, 3, 1> Eigen MatrixBase<Eigen Matrix<float, 3, 1, 0, 3, 1> > cross3<Eigen Matrix<float, 3, 1, 0, 3, 1> >(Eigen MatrixBase<Eigen Matrix<float, 3, 1, 0, 3, 1> > const&) const

collect2.exe*: error: ld returned 1 exit status
`

@rpavlik
Copy link
Member

rpavlik commented Dec 8, 2023

hmm. Weird. I totally haven't touched this in years, but I was pretty sure I used cross products back when I did use it.

You should be able to see the diffs I made to the upstream code, maybe try applying those to a more recent version of eigen? It's on gitlab now, not mercurial/bitbucket, so it's easier to work with.

There is also libc++ out now, which is a lot easier to get going on small systems and a lot easier to work with in general.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants