Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3598834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:17:31+00:00 2026-05-18T20:17:31+00:00

I have some object whish moves by sinusoid. I have to animate it each

  • 0

I have some object whish moves by sinusoid. I have to animate it each time it reaches the top (or the bottom) of the “wave”. I want to do this with derivative function: as we know it changes the value (from positive to negative or contrary) at that points. So the code is:

// Start value
int functionValue = +1;

// Function
float y = k1 * sinf(k2 * Deg2Rad(x)) + y_base;

// Derivative function
float tempValue = -cosf(y);

// Check whether value is changed
if (tempValue * functionValue < 0)
{
   animation = true;
}
functionValue = tempValue;

if I will output the tempValue it shows strange numbers:

0.851513
0.997643
0.0242145
0.690432
0.326303
-0.614262
0.892036
0.1348
0.709843
0.968676
0.0454846
0.920602
-0.423125
0.692132
-0.960107
0.0799654
-0.747722
-0.635241
0.148477
-0.98611
0.900912
-0.877801
0.811632
-0.362743
-0.233856
0.35512
-0.994107
0.885184
-0.468005
0.982489
0.675337
0.661048
0.870765
0.0312914
-0.319066
-0.602956
-0.996169
-0.95627

And animation is strange too. Not only at the top of wave. What’s wrong is there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:17:32+00:00Added an answer on May 18, 2026 at 8:17 pm

    You have

    y = a * sin(b * x) + c
    

    derivative of that is

    y' = a * b * cos(b * x)
    

    not

    y' = -cos(y)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some object whish moves by sinusoid. I have to animate it each
I have an object config which has some properties. I can export this ok,
I have some issues with this: First I create my object and move it
I have some JS code which generates the following object, return { type: some
I have an ActiveX object which extends some functions. I have a web page
So I have an object which has some fields, doesn't really matter what. I
I have an object which straight forward instance variables. Some are NSString, some are
I have created some python code which creates an object in a loop, and
I have some code where I really want to call a virtual method from
I am implementing game application.In which there is some mosquito(object).They moves randomly on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.