Skip to content

Instantly share code, notes, and snippets.

@sknjpn
Created August 19, 2017 11:39
Show Gist options
  • Save sknjpn/8c93f99924a940da053ee2c1a97e4a9d to your computer and use it in GitHub Desktop.
Save sknjpn/8c93f99924a940da053ee2c1a97e4a9d to your computer and use it in GitHub Desktop.
//Export
for (int i = 0; i < 2; i++)
{
auto t = tinyCamera.createTransformer(i);
for (auto& e : exports)
{
if ((ui.drawExportLineEnabled && (ui.selectedItemType == -1 || ui.selectedItemType == e.itemType)) || (ui.selectedUrbanID != -1 && (e.from->id() == ui.selectedUrbanID || e.to->id() == ui.selectedUrbanID)))
{
double width = 0.005*e.numItemPerDay;
LineString l;
for (double x = 0; x <= 1.0; x += 0.1)
{
double y = 0.25 - pow(x - 0.5, 2.0);
l.emplace_back(e.from->pos().mPos.lerp(e.to->pos().mPos, x).movedBy(0, -y));
}
l.draw(width, ColorF(itemData[e.itemType].color,0.8));
//Line line(e.from->pos().mPos, e.to->pos().mPos);
//line.drawArrow(width, Vec2(line.length(), line.length())*0.1, ColorF(itemData[e.itemType].color, 0.8));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment