Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duck displaced area doesn't look correct. It also deviates from getDisplacedVolume #159

Closed
samreid opened this issue Jun 3, 2024 · 2 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Jun 3, 2024

From #123, the duck displaced area doesn't look correct. It also deviates from getDisplacedVolume:

  /**
   * Returns the cumulative displaced volume of this object up to a given y level.
   *
   * Assumes step information was updated.
   */
  public getDisplacedArea( liquidLevel: number ): number {
    if ( liquidLevel < this.stepBottom || liquidLevel > this.stepTop ) {
      return 0;
    }
    else {
      // const ratio = ( liquidLevel - this.stepBottom ) / ( this.stepTop - this.stepBottom );

      return 0.1; // 4 * pi * a * c * ( t - t^2 )
    }
  }
@AgustinVallejo
Copy link
Contributor

@samreid and I looked into the Duck's volume and area displacement, and saw that it behaved linearlly, and we didn't like that. So we modelled the duck after the Ellipsoid and now it re-uses that implementation.

If we ever decide to actually model the duck's volume and cross sectional area, we'd have to go a longer route with the 3d model. It'd take about 2 or 3 days fully thinking about this.

We opted for the ellipsoid for now. Closing

@samreid
Copy link
Member Author

samreid commented Jun 12, 2024

@zepumph and I saw this code near the bottom of Duck.ts:

  /**
   * Returns the volume of a duck with the given axis-aligned bounding box.
   */
  private static getVolume( size: Bounds3 ): number {

    // Hard coded normalized volume obtained from Blender
    return 0.5 * size.width * size.height * size.depth;
  }

So it seems some parts are still treating the duck as a cuboid instead of ellipsoid. Should this part be updated to act more like an ellipsoid?

@samreid samreid removed their assignment Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants