This section is no longer being used. Please join the discussion in the Developer Forums.
LEAPCircleGesture direction??
| Votes | Replies | Views | Asked by |
|---|---|---|---|
| 0 | 1 | 127 | Alex Cheng about 7 months ago |
Hi, I'm obj-c developer.
Is there anyway to check the Circle gesture's direction?
I would like to know it's clockwise rotation or counter-clockwise rotation.
According the sample code, I think it could be determined by sweptAngle.
any hint to make that ??
| Votes | Answered by |
|---|---|
| 0 | Joe Ward LM about 7 months ago |
Compare the direction of the pointable making the gesture to the normal of the circle. If they are pointing in generally the same direction then the circle is clockwise. There are examples for this in all the samples except the ObjectiveC and JavaScript samples. In Java:
String clockwiseness;
if (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI/4) {
// Clockwise if angle is less than 90 degrees
clockwiseness = "clockwise";
} else {
clockwiseness = "counterclockwise";
}
1 comment
|
By Joe Ward LM on 2013-03-13 |
I just noticed that you are working in Objective C. The angleTo function isn't in the Objective C wrapper yet. Should be in the next release. In the meantime, here's an implementation. |