作业0
配置环境:
基本配置在pa0中都有,下面介绍使用vscode连接VB虚拟机快捷开发
vscode连接VB虚拟机
1.用户名
可以看到Username为cs18
并非为css180
2.密钥
在window主机生成密钥
ssh-keygen #一路回车
3.VB虚拟机配置ssh
- sshd_config配置
cd /etc/ssh/
vim sshd_config
复制以下粘贴到文末:
其实主要修改为:
PermitRootLogin yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys
PasswordAuthentication yes
PermitEmptyPasswords yes
- 放置公钥 到下面文件 没有就新建
~/.ssh/authorized_keys
- 重启ssh服务
sudo service ssh restart
4.虚拟机网卡
按下图设置后保存
查看地址
ifconfig
复制红线地址
在window cmd下测试连接
ssh cs18@地址
可进入虚拟机则进入下一步
5.vscode连接
输入
ssh cs18@地址
如果连接不上则进行 vscode ssh配置
Host 地址
HostName 地址
User cs18
Port 22
IdentityFile "C:\Users\你的用户名\.ssh\id_rsa"
至此配置完成 可以愉快的在windows上写代码了,与实际没有差异,任何跳转\提示功能健全
答案:
Main.cpp
#include<cmath>
#include<eigen3/Eigen/Core>
#include<eigen3/Eigen/Dense>
#include<iostream>
#include "Point2D.h"
using namespace std;
void example();
void rotate_point(Point2D &point,float theta);
int main(){
Point2D point;
point.x = 2.0f;
point.y = 1.0f;
rotate_point(point,45);
cout<<point.x<<endl;
cout<<point.y<<endl;
}
void rotate_point(Point2D &point,float theta) {
theta = theta/180.0*acos(-1);
Eigen::Matrix2f rotate_matrix;
rotate_matrix << cos(theta) ,-sin(theta),
sin(theta) , cos(theta);
Eigen::Matrix<float,2,1> point_matrix;
point_matrix << point.x,point.y;
Eigen::Matrix<float,2,1> result = rotate_matrix * point_matrix;
point.x = result[0