This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RotationalMechanics | |
{ | |
mat4 orientation; | |
mat4 tensorOfInertia; | |
mat4 iTensorOfInertia; | |
vec3 angularMomentum; | |
double width, height, depth; | |
public: | |
void update(float dt); | |
const mat4& getOrientation() const { return orientation; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Model matrix : an identity matrix (model will be at the origin) | |
glm::mat4 Model = glm::mat4(1.0f); | |
// Our ModelViewProjection : multiplication of our 3 matrices | |
glm::mat4 MVP = Projection * View * Model; // Remember, matrix multiplication is the other way around |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glm::mat4 MVP = Projection * View * mechanicalModel.getOrientation() * glm::scale(glm::mat4(1.0f), vec3(1.0, 1.73, 2.24)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'image' | |
function ElasticTransform(img, alpha, sigma) | |
--[[ | |
Parameters | |
---------- | |
img: Tensor of size KxHxW | |
Image on which elastic transformation have to be applied | |
alpha: number | |
Intensity of the transformation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "due_sam3x.init.h" | |
int main(void) | |
{ | |
/* The general init (clock, libc, watchdog disable) */ | |
init_controller(); | |
PIO_Configure(PIOB, PIO_OUTPUT_1, PIO_PB27, PIO_DEFAULT); | |
while(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
typedef struct { | |
WoReg UART_CR; /**< \brief (Uart Offset: 0x0000) Control Register */ | |
RwReg UART_MR; /**< \brief (Uart Offset: 0x0004) Mode Register */ | |
WoReg UART_IER; /**< \brief (Uart Offset: 0x0008) Interrupt Enable Register */ | |
WoReg UART_IDR; /**< \brief (Uart Offset: 0x000C) Interrupt Disable Register */ | |
RoReg UART_IMR; /**< \brief (Uart Offset: 0x0010) Interrupt Mask Register */ | |
RoReg UART_SR; /**< \brief (Uart Offset: 0x0014) Status Register */ | |
RoReg UART_RHR; /**< \brief (Uart Offset: 0x0018) Receive Holding Register */ | |
WoReg UART_THR; /**< \brief (Uart Offset: 0x001C) Transmit Holding Register */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
typedef struct { | |
WoReg US_CR; /**< \brief (Usart Offset: 0x0000) Control Register */ | |
RwReg US_MR; /**< \brief (Usart Offset: 0x0004) Mode Register */ | |
WoReg US_IER; /**< \brief (Usart Offset: 0x0008) Interrupt Enable Register */ | |
WoReg US_IDR; /**< \brief (Usart Offset: 0x000C) Interrupt Disable Register */ | |
RoReg US_IMR; /**< \brief (Usart Offset: 0x0010) Interrupt Mask Register */ | |
RoReg US_CSR; /**< \brief (Usart Offset: 0x0014) Channel Status Register */ | |
RoReg US_RHR; /**< \brief (Usart Offset: 0x0018) Receiver Holding Register */ | |
WoReg US_THR; /**< \brief (Usart Offset: 0x001C) Transmitter Holding Register */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setupUART() | |
{ | |
PIO_Configure(PIOA, PIO_PERIPH_A,PIO_PA8A_URXD|PIO_PA9A_UTXD, PIO_DEFAULT); | |
/* Enable the pull up on the Rx and Tx pin */ | |
PIOA->PIO_PUER = PIO_PA8A_URXD | PIO_PA9A_UTXD; | |
/*Включаем UART, подавая на него тактирование*/ | |
pmc_enable_periph_clk(ID_UART); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
while (1) | |
{ | |
//Если получили очередной байт из UART - прочитаем его в переменную received_data | |
if ((UART->UART_SR & UART_SR_RXRDY) == UART_SR_RXRDY ) | |
{ | |
uint32_t received_data = UART->UART_RHR; | |
... | |
} | |
//Если готовы отправить очередной байт (зранится в data_to_transmit) через UART - запишем в регистр UART_THR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
while (1) | |
{ | |
//Если получили очередной байт из UART - прочитаем его в переменную received_data | |
if ((UART->UART_SR & UART_SR_RXRDY) == UART_SR_RXRDY ) | |
{ | |
uint32_t received_data = UART->UART_RHR; | |
... | |
} | |
//Если готовы отправить очередной байт (зранится в data_to_transmit) через UART - запишем в регистр UART_THR |