summaryrefslogtreecommitdiff
path: root/ofxHelios/src/ofxHelios.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2018-02-04 03:53:59 +0000
committerTim Redfern <tim@getdrop.com>2018-02-04 03:53:59 +0000
commit60e218550dd4f584da2f6f74ffc755f5f34c20a7 (patch)
tree170421cbaa6047a8e57ecd3a176fe8b91807e50f /ofxHelios/src/ofxHelios.cpp
parent25dfa55d4574ad70f62b2c536b024741a4a37b0b (diff)
lorenzo show
Diffstat (limited to 'ofxHelios/src/ofxHelios.cpp')
-rw-r--r--ofxHelios/src/ofxHelios.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/ofxHelios/src/ofxHelios.cpp b/ofxHelios/src/ofxHelios.cpp
index d5bf812..9521ec2 100644
--- a/ofxHelios/src/ofxHelios.cpp
+++ b/ofxHelios/src/ofxHelios.cpp
@@ -17,7 +17,7 @@ we see curved on both edges betwen shapes, but not on corners
int ofxHelios::draw(vector <ofPolyline> &lines,ofColor colour,int intensity){
vector <colourPolyline> output;
for (auto& line:lines){
- output.push_back(line);
+ output.push_back(colourPolyline(line,colour));
}
return draw(output,intensity);
}
@@ -40,8 +40,8 @@ int ofxHelios::draw(vector <colourPolyline> &lines, int intensity){
//todo: add a transform
//POC
- int xoffs=0x800-(ofGetWidth()/2);
- int yoffs=0x800-(ofGetHeight()/2);
+ int xoffs=output_centre.x-(ofGetWidth()/2);
+ int yoffs=output_centre.y-(ofGetHeight()/2);
if (device!=OFXHELIOS_NODEVICE){
while (!dac.GetStatus(device)); //timeout for this?
@@ -50,6 +50,7 @@ int ofxHelios::draw(vector <colourPolyline> &lines, int intensity){
vector <HeliosPoint> points;
for (auto& line:lines){
+
float dist=abs(prev_point.distance(line[0]));
if (dist>SUBDIVIDE){
//draw blanking points if required (only between shapes)
@@ -113,7 +114,12 @@ int ofxHelios::draw(vector <colourPolyline> &lines, int intensity){
}
- if (HELIOS_ERROR==dac.WriteFrame(device, pps, HELIOS_FLAGS_DEFAULT, &points[0], points.size())){
+ for (auto& p:points){ //hopefully avoid problems with excessive scale
+ p.x=min((uint16_t)0xfff,p.x);
+ p.y=min((uint16_t)0xfff,p.y);
+ }
+
+ if (HELIOS_ERROR==dac.WriteFrame(device, pps, HELIOS_FLAGS_DEFAULT, &points[0], min(HELIOS_MAX_POINTS,(int)points.size()))){
printf("ofxHelios: write error (%i,%i,%i,%i)\n",device, pps, HELIOS_FLAGS_DEFAULT, (int)points.size());
return -1;
}