Kernel SDK Developer's Guide > Working with the Ge Library > Working with Surfaces > Working with Cones
Working with Cones

Using the Ge library you can create and modify circular and elliptical cones. The base of circular cones is a full circle or circular arc; elliptical cones are formed by an ellipse or elliptical arc. Circular and elliptical cones are represented by the OdGeCone and OdGeEllipCone classes respectively.

Cones of both types have the following common parameters: height, axis of symmetry, half angle, base circle or ellipse and U parameter scale. The axis of symmetry is a normalized vector that represents the axis of rotation. Circular cones are bounded and cannot be two-sided.

Since a cone is a 3D parametric surface, there is a subset of the parameter plane that is mapped to the surface. Parameter U varies along the generating line. U is dimensionless, measured in U parameter scale, multiplied by the absolute value of cosine of the half angle. U parameter scale is equal to the major radius of the base by default. U increases in the direction of the axis of symmetry if U parameter scale is positive, and decreases otherwise.

Parameter V is the revolution angle measured from the refAxis or majorAxis for circular and elliptical cone respectively. For a closed cone, it defaults to [-OdaPI, OdaPI]. The positive direction of V is defined by applying the right-hand rule along the axis of symmetry. The surface is periodic in V with a period of Oda2PI. All angles are specified in radians.

If the cosine of the half angle is positive, this cone is convex. If the cosine of the half angle is negative, this cone is concave. If the cosine and sine of the half angle have the same sign, the apex is on the opposite direction of the symmetric axis and the radius increases along the symmetric axis. If the cosine and sine of the half angle have different signs, the apex is on the direction of the symmetric axis and the radius decreases along the symmetric axis. Both the cosine and sine of the half angle can't be zero.

Cone objects of both types contain the following methods for working with common cone properties:

  • apex() — Returns the apex of this cone.
  • getPoleParam() — Returns the U parameter in the apex of this cone.
  • axisOfSymmetry() — Returns the axis of symmetry.
  • baseCenter() — Returns the center of the base.
  • halfAngle() — Returns the angle between the generating line and the axis of symmetry for a circular cone. Returns the angle between the generating line passing through the major axis and the axis of symmetry for an elliptical cone.
  • getHeight() — Returns the height interval along the axis of symmetry.
  • heightAt() — Returns the height of this cone corresponding to the specified position on the U-axis.
  • getHalfAngle() — Returns the cosine and sine of the angle between the generating line and the axis of symmetry for a circular cone. Returns the cosine and sine of the angle between the generating line passing through the major axis for an elliptical cone.
  • setHeight() — Sets the height interval of this cone.
  • isOuterNormal() — Checks whether the normal to this cone is pointing outward.
  • getUParamScale() — Returns U parameter scale, which can be used for reparametrization of the cone. Negative scale reverses the direction in which U is increasing.
  • setUParamScale() — Sets U parameter scale.

Since cones are surfaces, you can manage their normals with methods of the base OdGeSurface class.

Working with circular cones

The base of a circular cone is a circle or a circular arc defined by the following parameters: center, radius, reference vector, and start and end angles.

To create a circular cone, use one of the OdGeCone() constructors:

  • OdGeCone::OdGeCone() — Default constructor. Constructs a circle cone with half angle of 45°, reference vector of (1,0,0), base center of (0,0,0), axis of symmetry of (0,1,0), and base radius of 2.0.
  • OdGeCone::OdGeCone(double cosineAngle, double sineAngle, const OdGePoint3d& baseOrigin, double baseRadius, const OdGeVector3d& axisOfSymmetry) — Creates a circular cone with specified cosine and sine of the angle between the generating line and the axis of symmetry, base center, base radius, and axis of symmetry.
  • OdGeCone::OdGeCone(double cosineAngle, double sineAngle, const OdGePoint3d& baseOrigin, double baseRadius, const OdGeVector3d& axisOfSymmetry, const OdGeVector3d& refAxis, const OdGeInterval& height, double startAng, double endAng) — Creates a circular cone with specified cosine and sine of the angle between the generating line and the axis of symmetry, base center, base radius, axis of symmetry, reference axis, height, start and end angles of the base.
  • OdGeCone::OdGeCone(const OdGeCone& cone) — Creates a cone cloned from the source cone object.

The OdGeCone class provides methods for setting and returning specific circular cone properties.

The baseRadius(), refAxis() and getAngles() methods are used to obtain the base radius, reference axis and start and end angles respectively.

You can also check if this cone is closed with the isClosed() method. A cone is considered closed if it is a full circle.

To set circular cone properties, use the corresponding methods: setAngles(), setBaseRadius(), or one of the set() methods. For example:

OdGeCone cone1;
cone1.set(1.0, 1.0, OdGePoint3d(1.0, 1.0, 0.0), 3.0, OdGeVector3d(0.0, 1.0, 0.0));

OdGeCone cone2(0.7, 0.7, OdGePoint3d(0.0, 0.0, 0.0), 3.0, OdGeVector3d(0.0, 1.0, 0.0));
cone2.setBaseRadius(5);

Working with elliptical cones

The base of an elliptical cone is an ellipse or elliptical arc defined by the following parameters: center, major and minor axes, major and minor radii, and start and end angles.

To create an elliptical cone, use one of the OdGeEllipCone() constructors:

  • OdGeEllipCone::OdGeEllipCone() — Default constructor. Constructs an elliptical cone with half angle of 45°, a reference axis of (1,0,0), circular base with center of (0,0,0), an axisOfSymmetry of (0,1,0), and radii of 1.0.
  • OdGeEllipCone::OdGeEllipCone(double cosineAngle, double sineAngle, const OdGePoint3d& origin, double minorRadius, double majorRadius, const OdGeVector3d& axisOfSymmetry) — Creates an elliptical cone with specified cosine and sine of the angle between the generating line passing through the major axis and the axis of symmetry, base center, minor radius, major radius, and axis of symmetry.
  • OdGeEllipCone::OdGeEllipCone(double cosineAngle, double sineAngle, const OdGePoint3d& baseOrigin, double minorRadius, double majorRadius, const OdGeVector3d& axisOfSymmetry, const OdGeVector3d& majorAxis, const OdGeInterval& height, double startAng, double endAng) — Creates an elliptical cone with specified cosine and sine of the angle between the generating line passing through the major axis and the axis of symmetry, base center, minor radius, major radius, axis of symmetry, major axis, height, start and end angles of the base.
  • OdGeCone::OdGeCone(const OdGeCone& cone) — Creates a cone cloned from the source cone object.

The OdGeEllipCone class provides methods for setting and returning specific elliptical cone properties.

The majorRadius(), minorRadius(), majorAxis(), minorAxis() and getAngles() methods are used to obtain the major radius, minor radius, major axis, minor axis, start and end angles respectively. The radiusRatio() method returns the ratio of the minor to major radius of the elliptical cone.

To set elliptical cone properties, use the corresponding methods: setMinorRadius(), setMajorRadius(), setAngles() or one of the set() methods. For example:

OdGeEllipCone ellipCone1;
ellipCone1.set(0.7, 0.7, OdGePoint3d(0.0, 0.0, 0.0), 2.0, 4.0, OdGeVector3d(0.0, 1.0, 0.0));

OdGeEllipCone ellipCone2(0.7, 0.7, OdGePoint3d(0.0, 0.0, 0.0), 2.0, 5.0, OdGeVector3d(0.0, 1.0, 0.0));
ellipCone2.setAngles(0, OdaPI/2);

You can also use the intersectWith(). For more information on how to use intersectWith() methods, see Working with Intersected Entities.

See Also

Working with Elliptical Arcs

Working with Circular Arcs

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.