Skip to content

Module GoTools Core Examples

Georg Muntingh edited this page Aug 20, 2017 · 3 revisions

Example adapt_curve.C

This program demonstrates the use of the class AdaptCurve. The class can generate a B-spline curve that approximates an evaluator based curve to satisfy a given accuracy.

The program reads a 2D parameter curve and a surface from file, and lifts the curve onto the surface to make an evaluator based curve. This evaluator based curve is then used as input to the AdaptCurve constructor.

Example append_curve.C

This program demonstrates the use of the function SplineCurve::append_curve declared in SplineCurve.h. The function joins two SplineCurves by appending the start of the second curve to the end of the first curve. The two curves must be of the same type

Example approx_curve.C

This program demonstrates the use of the class ApproxCurve. The class can generate a B-spline curve that approximates a set of parametrized points for a given accuracy by inserting new knots in the curve until the required accuracy is reached.

Example approx_surface.C

This program demonstrates the use of the class ApproxSurf. The class can generate a new tensor product B-spline surface with four boundary curves that approximates a set of parametrized points for a given accuracy, or modify an old surface by a set of parametrized points.

Example circle.C

This program demonstrates the use of the class Circle. It is a subclass of ElementaryCurve. The geometry space dimension of a circle is either 2 or 3. The default parametrization is an angle between 0 and $2\pi$.

Example closestpoint_curve.C

This program demonstrates the use of the two functions

ParamCurve::closestPoint(const Point& pt, double& clo_t, Point& clo_pt, double& clo_dist)
SplineCurve::closestPoint(const Point& pt, double tmin, double tmax, double& clo_t, Point& clo_pt, double& clo_dist, double const *seed = 0).

They compute the closest point on a curve from a specified point.

Example closestpoint_degenerate_sf.C

This program demonstrates the use of the function

SplineSurface::closestPoint(const Point& pt, double& clo_u, double& clo_v, Point& clo_pt, double& clo_dist, double epsilon, const RectDomain* domain_of_interest = NULL, double *seed = 0)

The declaration of the function is in ParamSurface.h. The function computes the closest point on a surface from a specified point. It reads a spline surface file in g2-file format and a file in plain ASCII format with the $xyz$-coordinates of the points we want to find the closest point on the surface to.

Example closestpoint_surface.C

This program demonstrates the use of the function

SplineSurface::closestPoint(const Point& pt, double& clo_u, double& clo_v, Point& clo_pt, double& clo_dist, double epsilon, const RectDomain* domain_of_interest = NULL, double *seed = 0)

The declaration of the function is in ParamSurface.h. The function compute the closest point on a surface from a specified point. It reads a spline surface file in g2-file format and a file in plain ASCII format with the $xyz$-coordinates of the points we want to find the closest point on the surface to.

Example cone.C

This program demonstrates the use of the class Cone. It is a subclass of ElementarySurface. The geometry space dimension of a cone is 3. The default parametrization is the angle $u\in [0,2\pi]$ and the distance $v\in (-\infty,\infty)$.

Example const_param_curves.C

The program demonstrates the use of the function

SplineSurface::constParamCurve(double parameter, bool pardir_is_u)

The declaration of the function is in SplineSurface.h.

Example coons_patch_gen.C

This program demonstrates the use of some of the functions in namespace CoonsPatchGen. The functions can be used to create a Coons Patch or a Gordon Surface. The functions returns a SplineSurface pointer to the created surface.

Example cylinder.C

This program demonstrates the use of the class Cylinder. It is a subclass of ElementarySurface. The geometry space dimension of a cylinder is 3. The default parametrization is the angle $u\in [0,2\pi]$ and the distance $v\in (-\infty,\infty)$

Example ellipse.C

This program demonstrates the use of the class Ellipse. It is a subclass of ElementaryCurve. The geometry space dimension of an ellipse is either 2 or 3. The default parametrization is an angle between 0 and $2\pi$.

Example interpol_curve_free.C

This program reads a point data set from a file, interpolates a spline curve through the points and writes an output file with the spline curve and the input points.

Example interpol_curve_hermite.C

This program reads a point data set from a file, interpolates a spline curve through the points and write two output files: One file with spline curve data and one file with tangent vectors from the input points.

Example linear_swept_surface.C

This program demonstrates the use of the static function linearSweptSurface in the class SweepSurfaceCreator. The function can generate a B-spline surface by sweeping one curve along another. A given point on the sweeping curve will be swept along the other curve.

Example project_curve.C

This program demonstrates the use of the function

void CurveCreators::projectCurve(shared_ptr<ParamCurve>& space_cv,
                                 shared_ptr<ParamSurface>& surf,
  			            double epsge,
			            shared_ptr<SplineCurve>& proj_cv,
			            shared_ptr<SplineCurve>& par_cv)

The function generates a cubic spline curve (order four) that lies on a given SplineSurface and is the projection of a given space curve (in 3D space) onto that surface, within a given tolerance. The given space curve should be close to the surface.

Example rotational_swept_surface.C

This program demonstrates the use of the static function rotationalSweptSurface in the class SweepSurfaceCreator. The function can generate a B-spline surface by rotating a curve around an axis.

Example sphere.C

This program demonstrates the use of the class Sphere. It is a subclass of ElementarySurface. The geometry space dimension of a sphere is 3. The default parametrization is the angles $u\in [0, 2\pi]$ and $v\in [-\pi/2, +\pi/2]$.

Example surface_of_revolution.C

This program demonstrates the use of the class SurfaceOfRevolution. SurfaceOfRevolution is swept out by a SplineCurve that is rotated around an axis with a complete revolution, and is thereby a parametric surface. The geometry space dimension is 3. The curve must be such that it doesn't lead to a self-intersecting surface.

Example torus.C

This program demonstrates the use of the class Torus. It is a subclass of ElementarySurface. The geometry space dimension of a torus is 3. The default parametrization is in terms of the angles $u$ along the major circle and $v$ along the minor circle, between 0 and $2\pi$.

Clone this wiki locally