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
| Mat4 RotationMatrix(float radians) | |
| { | |
| Mat4 result; | |
| // assuming column-major order (first index is column, second is row) | |
| result[0][0] = Math.Cos(radians); | |
| result[0][1] = -Math.Sin(radians); | |
| result[1][0] = Math.Sin(radians); | |
| result[1][1] = Math.Cos(radians); | |
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
| import lejos.nxt.Button; | |
| import lejos.nxt.addon.GyroSensor; | |
| import lejos.nxt.SensorPort; | |
| import lejos.nxt.NXTMotor; | |
| import lejos.nxt.MotorPort; | |
| import javax.microedition.lcdui.Graphics; | |
| /** | |
| * This program makes an NXT robot drive a predetermined path. It uses the wheel tachometers (encoders) and | |
| * a gyro sensor to keep track of the robot's position and heading, then uses a basic "pure pursuit" algorithm |
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
| import re | |
| def frequency(note): | |
| aFreqs = { | |
| -1: 13.75, | |
| 0: 27.5, | |
| 1: 55.0, | |
| 2: 110.0, | |
| 3: 220.0, | |
| 4: 440.0, |
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
| /* | |
| * This file actually includes the implementations from HandmadeMath.h so the | |
| * main test can link with them. | |
| */ | |
| #define HANDMADE_MATH_NO_INLINE | |
| #define HANDMADE_MATH_IMPLEMENTATION | |
| #define HANDMADE_MATH_CPP_MODE | |
| #include "HandmadeMath.h" |
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
| // | |
| // Chaining functions is kind of annoying, and seems unnecessary. Let's try | |
| // building verbal expressions using arrays instead. | |
| // | |
| // (Plus let's throw some new features in, because regexes can do a lot!) | |
| // | |
| // | |
| // Simple stuff can be done like this: | |
| // |
NewerOlder