GithubHelp home page GithubHelp logo

shapes3d's Introduction

Shapes3D

This C# library will help you to calculate of volume, surface area and different types of movement of geometric shapes. Class library Shape3D contains abstract class AbstractShape, which has 3 abstract members, method Volume() (which calculates volume of shape) and method Area() (which calculates area of shape).

protected float a;
protected float b;
protected float c;
public abstract float Volume { get; }
public abstract float Area { get; }

Shape3D contains struct Point3D for determining x, y, z coordinates.

public struct Point3D
{
  public float X { get; set; }
  public float Y { get; set; }
  public float Z { get; set; }

  public Point3D(float x, float y, float z): this()
    {
      this.X = x;
      this.Y = y;
      this.Z = z;
    }
}

It has IMoveable interface , which provides shape's moving. It contains methods MoveTo(), MoveBy()

  • Method MoveTo() allows you to move the shape to given location.
  • Method MoveBy() allows you to move the shape by given difference coordinates dx, dy, dz.
public interface IMoveable
{
void MoveBy(float dx, float dy, float dz);
void MoveTo(float x, float y, float z);
void MoveTo(Point3D p);
}

How to use

Classes Ellipsoid and Parallelepiped are inherited from AbstractShape abstract class and IMoveable interface. For using this class library is necessary to add namespace Shape3D

Ellipsoid elips = new Ellipsoid(18, 21, 9);
Console.WriteLine("The volume of ellopsoid = {0} \nThe area of ellipsoid = {1}", elips.Volume, elips.Area);
Parallelepiped piped = new Parallelepiped(22, 13, 42);
Console.WriteLine("The volume of parallelepiped = {0}\nThe area of parallelepiped = {1}", piped.Volume, piped.Area);

Result

GitHub Logo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.