Giter Club home page Giter Club logo

cpp_cad's Introduction

C++ CAD

This is a small library for outputting CAD models from C++. It contains implementations of tesselations of a couple of basic primitives (sphere, cone / cylinder), and basic helper functions.

Most of the functionality comes from the CGAL library, such as:

  • Constructive solid geometry binary operations (difference, union).
  • Convex hulls.
  • Minkowski sums of solids.

CGAL supports input and output in a few formats, such as Waveform OBJ, OFF, VRML.

Example

#include <cpp_cad.h>


typedef cpp_cad::Nef_polyhedron_3 Nef_polyhedron_3;


// Outputs the difference between a cube and a sphere as an OBJ file:
int main()
{
    // A 10 x 10 x 10 unit cube:
    Nef_polyhedron_3 nef_cube = Nef_polyhedron_3::make_cube(10, 10, 10);
    // A sphere with radius 10 units, tessalated with 16 divisions per great
    // circle:
    Nef_polyhedron_3 nef_sphere = Nef_polyhedron_3::make_sphere(10, 16);
    // The sphere subtracted from the cube:
    Nef_polyhedron_3 diff = nef_cube - nef_sphere;

    diff.write_to_obj_file("output.obj");

    return 0;
}

Requirements

  • C++ 11
  • libCGAL

License

Apache 2.0.

Installation

Ubuntu 16

Build a Debian package:

./build_packages.sh

Install the package:

sudo dpkg -i build/libcppcad_0.1.0.deb

Other Platforms

  • Package C++ CAD for your platform.
  • Install the package.
  • (Contribute packaging.)

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.