Using the Ge library you can create and modify circular and elliptical cylinders. The base of circular cylinders is a full circle or circular arc; elliptical cylinders are formed by an ellipse or elliptical arc. Circular and elliptical cylinders are represented by the OdGeCylinder and OdGeEllipCylinder classes respectively.
Cylinders of both types have the following common parameters: height, axis of symmetry, base circle or ellipse and U parameter scale. The axis of symmetry is a normalized vector that represents the axis of rotation.
Since a cylinder is a 3D parametric surface, there is a subset of the parameters plane that is mapped to the surface. Parameter U varies along the generating line. U is dimensionless, measured in U parameter scale. 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 cylinder respectively.
For a closed cylinder, it defaults to [-OdaPI, OdaPI). The right hand rule applied along the direction of the axis
of symmetry defines the positive direction of V. The surface is periodic in V with a period of Oda2PI.
OdGeCylinder and OdGeEllipCylinder objects contain the following methods for working with cylinder properties:
axisOfSymmetry()
— Returns the axis of symmetry.origin()
— Returns the origin of the cylinder.getHeight()
— Returns the height interval along the axis of symmetry.heightAt()
— Returns the height of this cylinder corresponding to the specified position on the U-axis.setHeight()
— Sets the height interval of this cylinder.isOuterNormal()
— Checks if the normal to this cylinder is pointing outward.getUParamScale()
— Returns U parameter scale, which can be used for reparametrization of the cylinder. Negative scale reverses the direction in which U is increasing.setUParamScale()
— Sets U parameter scale.The base of a circular cylinder is a circle or a circular arc defined by the following parameters: center, radius, reference vector, start and end angles. The cylinder is generated by revolving a line parallel to the axis of symmetry, at a distance of the radius.
To create a circular cylinder, use one of the OdGeCylinder()
constructors:
OdGeCylinder::OdGeCylinder()
— Default constructor. Constructs a circle cylinder with the reference vector of (1,0,0), the center of (0,0,0), axis of symmetry of (0,1,0) and the radius of 2.0.OdGeCylinder::OdGeCylinder(double radius, const OdGePoint3d& origin, const OdGeVector3d& axisOfSymmetry)
— Creates a circular cylinder with the specified radius, origin and axis of symmetry.OdGeCylinder::OdGeCylinder(double radius, const OdGePoint3d& origin, const OdGeVector3d& axisOfSymmetry, const OdGeVector3d& refAxis, const OdGeInterval& height, double startAng, double endAng)
—
Creates a circular cylinder with the specified radius, origin, axis of symmetry, reference axis, height, start and end angles.OdGeCylinder::OdGeCylinder(const OdGeCylinder&)
— Creates a cylinder cloned from the source cylinder object.The OdGeCylinder class provides methods for setting and returning specific circular cylinder properties.
The radius()
, refAxis()
and getAngles()
methods
are used to obtain the radius, reference axis and start and end angles respectively.
To set circular cylinder properties, use the corresponding methods: setAngles()
, setRadius()
or one of the set()
methods. For example:
OdGeCylinder cyl1;
OdGeInterval interval;
cyl1.getHeight(interval);
cyl1.set(10.0, OdGePoint3d(0.0, 0.0, 0.0), OdGeVector3d(0.0, 3.0, 0.0));
interval.setLower(0.0);
interval.setUpper(11.0);
cyl1.setHeight(interval);
OdGeCylinder cyl2(3.7, OdGePoint3d(0.0, 0.0, 0.0), OdGeVector3d(0.0, 1.0, 0.0));
cyl2.setRadius(4.23);
You can also check if a cylinder intersects with linear entity using the intersectWith()
method. for example:
OdGeCylinder cyl1;
OdGeLine line(OdGePoint3d(), OdGePoint3d(1.0, 1.0, 1.0));
int numIntersections;
OdGePoint3d intersectionPoint1, intersectionPoint2;
bool bIntersected = cyl1.intersectWith(line, numIntersections, intersectionPoint1, intersectionPoint2);
The base of elliptical cylinder is an ellipse or elliptical arc defined by the following parameters: center, major and minor axes, major and minor radii, start and end angles. The cylinder is generated by a line parallel to the axis of symmetry, along an elliptical path.
To create an elliptical cylinder, use one of the OdGeEllipCylinder()
constructors:
OdGeEllipCylinder::OdGeEllipCylinder()
— Default constructor. Constructs an elliptical cylinder with a reference axis of (1,0,0), a center of (0,0,0), axis of symmetry of (0,1,0), and a radii of 2.0.OdGeEllipCylinder::OdGeEllipCylinder(double minorRadius, double majorRadius, const OdGePoint3d& origin, const OdGeVector3d& axisOfSymmetry)
— Creates an elliptical cylinder with specified minor radius, major radius, origin and axis of symmetry.OdGeEllipCylinder::OdGeEllipCylinder(double minorRadius, double majorRadius, const OdGePoint3d& origin, const OdGeVector3d& axisOfSymmetry, const OdGeVector3d& majorAxis, const OdGeInterval& height, double startAng, double endAng)
—
Creates an elliptical cylinder with specified minor radius, major radius, origin, axis of symmetry, major axis, height, start and end angles of the cylinder.OdGeEllipCylinder::OdGeEllipCylinder(const OdGeEllipCylinder&)
— Creates a cylinder cloned from the source cylinder object.The OdGeEllipCylinder class provides methods for setting and returning specific elliptical cylinder properties.
The majorRadius()
, minorRadius()
,
majorAxis()
, minorAxis()
and getAngles()
methods
are used to obtain the major radius, minor radius, major axis, minor axis, and start and end angles respectively.
The radiusRatio() method returns the
ratio of the minor to major radius of the elliptical cylinder.
To set elliptical cylinder properties, use the corresponding methods: setMajorRadius()
, setMinorRadius()
, setAngles()
,
or one of the set()
methods. For example:
OdGeEllipCylinder elCyl1;
elCyl1.set(1.0, 3.0, OdGePoint3d(0.0, 0.0, 0.0), OdGeVector3d(0.0, 1.0, 0.0));
elCyl1.setMajorRadius(3.2);
elCyl1.setMinorRadius(2);
OdGeEllipCylinder elCyl2(1.0, 2.0, OdGePoint3d(0.0, 0.0, 0.0), OdGeVector3d(0.0, 1.0, 0.0));
elCyl2.setMajorRadius(elCyl1.majorRadius());
elCyl2.setMinorRadius(elCyl1.minorRadius());
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|