struct Foo
{
int* data;
};
void DoStuff(const Foo& f)
{
f.data[3] = 10;
}
This file contains 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
Given J*JT * x = b, solve for x in linear time and space. | |
J is m by n | |
x is m by 1 | |
b is m by 1 | |
m < n | |
J is a rectangular matrix that represents a tree with equal and opposite entries. | |
For example: |
This file contains 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
// SPDX-FileCopyrightText: 2022 Erin Catto | |
// SPDX-License-Identifier: MIT | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#define RUN_TEST(T) \ | |
do { \ | |
int result = T(); \ |
This file contains 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
struct b2CircleShape | |
{ | |
// circle stuff | |
}; | |
struct b2PolygonShape | |
{ | |
// polygon stuff | |
}; |
This file contains 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 tests a two particle mass-spring-damper system with particle 1 connect to ground and | |
% particle 2 connected to particle 1. Particle 2 is much heavier than particle 1 and the | |
% simulation can go unstable if the soft constraint is made too stiff. | |
% Stability is improved by adding a relaxation step that applies the rigid constraint after | |
% the position update. | |
% no relax stable up to 13.5 Hz | |
% with relax stable up to 20.5 Hz | |
relax = 1; | |
hertz = 20.5; |
Option 1: static bodies
typedef struct b2StaticBodyDef
{
/// The world position of the body. Avoid creating bodies at the origin
/// since this can lead to many overlapping shapes.
b2Vec2 position;
/// The world angle of the body in radians.
float angle;