Games101作业0(vscode连接VB虚拟机)

作业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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值