# problems with ofPoint array

Hi,

I want to use ofInsidePoly to check if there’s a touch event on the iphone. But my ios simulator crashes. I’ve allready searched how to use this class best, but i cannot get it correct working. Could somebody give me some hints to do this the most effecient way? And how must i work with the ofTranslate function?

Here’s my code:

``````

std::vector<vector<ofPoint> > points;
vector<ofPolyline> line;

``````
``````
void ofxTriangleShape::triangleTouch(float \$touchX, float \$touchY){
for(int i=0; i<n; i++){
if(ofInsidePoly(\$touchX, \$touchY, points[i]) == true){
cout<<points[i][0]<<endl;
fillSlice[i] = true;
};
}

}

``````

here I load the values:

``````

points.resize(n);

for (float i = 0; i < n; i++) {

line.push_back(ofPolyline());

// pt 1
float theta = TWO_PI * i / n;
ofVec2f cur = ofVec2f(cos(theta), sin(theta)) * radius;
points[i].push_back(ofPoint(cur.x,cur.y));
cur +=   ofVec2f(0, 0) *offset;
line[i].lineTo(cur);

// pt 2
theta = TWO_PI * (i+1) / n;
cur = ofVec2f(cos(theta), sin(theta)) * radius;
points[i].push_back(ofPoint(cur.x,cur.y));
cur +=   ofVec2f(0, 0) *offset;

line[i].lineTo(cur);
// pt 3
cur = ofVec2f(0, sin(theta)) ;
points[i].push_back(ofPoint(cur.x,cur.y));
line[i].lineTo(cur);

line[i].close();

}

for (int i=0; i<n; i++){
mesh.push_back(ofMesh());
t.push_back(ofTessellator());

t[i].tessellateToMesh(line[i], OF_POLY_WINDING_NONZERO, mesh[i]);

}
}

``````