# Bird wing kinematics

**URL:** <https://discourse.processing.org/t/bird-wing-kinematics/28175>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [March 1, 2021, 7:58pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175 "2021-03-01T19:58:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![aljosa](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@aljosa](https://discourse.processing.org/u/aljosa)\
**Post date:** [March 1, 2021, 7:58pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/1 "2021-03-01T19:58:01Z")

</div>

float r1=200; // size of a first segment  
float r2=150; // size of a second segment  
float a1; // angle one  
float a2; // angle two  
float w=0; // angular velocity  
float A= 175; // amplitude half elipse hight (r1+r2)/2  
float b= 75; // half elipse width (r2/2)  
float cx= 275; // elipse center (r1+b)  
float x;

void setup() {

size(600, 600);  
}  
void draw() {  
display();  
render();  
}

void display () {  
background(255);

stroke(0);  
strokeWeight(2);  
translate(50, 300);

float x1= r1 \* cos (a1);  
float y1= r1 \* sin(a1);  
float x2 = x1+ r2 \* cos (a2);  
float y2 = y1+ r2 \* sin(a2);

circle (0, 0, 5);  
line (0, 0, x1, y1);  
circle (x1, y1, 5);  
line (x1, y1, x2, y2);

noFill ();  
strokeWeight (1);  
ellipse (cx, 0, 2_b, 2_A);  
}

void render () {

w+=0.01;

float y= A \* sin (w);  
float dx= b \* cos (w);  
float x= cx+dx;  
float Q1 = tan(y/x); // (+44) \> (-44)  
float h = y \* sin(Q1) + x \* cos(Q1); // (200 \< 350)

float Q2 = cos ((sq(r2)+sq(h)-sq(r1))/2_r2_h);  
float Q3 = cos ((sq(r1)+sq(h)-sq(r2))/2_r1_h);

a1=Q1+Q3;  
a2=Q1-Q2;

triangle (0, 0, x, y, x, 0);

// println(Q1\*(180/PI));  
//println (h);  
//println(Q3\*(180/PI));  
//println (Q2\*(180/PI));  
}`Preformatted text`

Hi  
please can some one help me find error in this code  
thanke you

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 1, 2021, 9:59pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/2 "2021-03-01T21:59:15Z")

</div>

Hey welcome.

Dont forget to format your code with \</\>

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [March 1, 2021, 10:03pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/3 "2021-03-01T22:03:15Z")

</div>

No, not really.

Questions: Do you have a existing code (from somewhere else) or a Wikipedia article where you come from we can use as a source information? So we can tell how the formulas look correctly?

And do you have an image / animation how it is supposed to look?

My first idea was you forgot to give the angles in radians, but this is not helpful

---

<div class="post-metadata">

**Author:** ![aljosa](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@aljosa](https://discourse.processing.org/u/aljosa)\
**Post date:** [March 6, 2021, 1:18pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/4 "2021-03-06T13:18:44Z")

</div>

![inverse kinematics](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9d990efbce46a7e141cc13dfbc9c434fbc7b5d6c.png)  
if this helps ?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [March 6, 2021, 2:33pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/5 "2021-03-06T14:33:05Z")

</div>

Thanks for that.

But how did you name the angle in the graphic in your Sketch? I can’t see theta 1 and 2 in your code

---

<div class="post-metadata">

**Author:** ![aljosa](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@aljosa](https://discourse.processing.org/u/aljosa)\
**Post date:** [March 7, 2021, 3:53pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/6 "2021-03-07T15:53:35Z")

</div>

Theta 1 is a1 and theta 2 is a2  
alpha is Q1 , beta is Q3

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [March 7, 2021, 6:24pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/7 "2021-03-07T18:24:26Z")

</div>

I can’t really help you with this, I am on a journey

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 7, 2021, 10:10pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/8 "2021-03-07T22:10:54Z")

</div>

Hello,

Please format your code as a courtesy to the community:  
[https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)  
You can go back and edit it.

I had to edit your code first before I could run it.  
I also corrected the spelling error in your subject.

Note the difference between these two:

`float Q2 = cos ((sq(r2)+sq(h)-sq(r1))/2*r2*h); // Original`

`float Q2 = cos ((sq(r2)+sq(h)-sq(r1))/(2*r2*h)); // Modified`

Give it a try for Q2 and Q3.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [March 7, 2021, 10:40pm UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/9 "2021-03-07T22:40:44Z")

</div>

> [@Chrisir](#):
>
> I can’t really help you with this, I am on a journey

have fun ❤ 😄

---

<div class="post-metadata">

**Author:** ![aljosa](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@aljosa](https://discourse.processing.org/u/aljosa)\
**Post date:** [March 9, 2021, 9:20am UTC](https://discourse.processing.org/t/bird-wing-kinematics/28175/10 "2021-03-09T09:20:18Z")

</div>

hi  
thanke you for help. I am new here and just learning things . Sory for mistakes i made.
