CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

曲线函数

2023-1-1 03:57| 发布者: admin| 查看: 658| 评论: 0|来自: AutoCAD

抽象基类提供了许多用于对曲线进行操作的函数,包括用于投影、扩展和偏移曲线的函数,以及一组用于查询曲线参数的函数。曲线可以在参数空间或笛卡尔坐标空间中定义。3D 曲线是一个参数 (f(t)) 的函数,而 3D 曲面是两个参数 (f(u,v)) 的函数。转换函数允许您将数据从其参数表示转换为笛卡尔坐标系中的点。例如,样条曲线最好在参数空间中表示。要将样条拆分为三个相等的部分,首先找到与样条的点对应的参数,然后在参数空间中对样条进行操作。曲线可用作修剪边界、延伸边界以及用于创建复杂 3D 实体的构造对象。AcDbCurve

可以将曲线投影到给定方向的平面上,如以下示例所示。

// Accepts an ellipse object ID, opens the ellipse, and uses
// its getOrthoProjectedCurve member function to create a
// new ellipse that is the result of a projection onto the
// plane with normal <1,1,1>.  The resulting ellipse is
// added to the model space block table record.
//
void
projectEllipse(AcDbObjectId ellipseId)
{
    AcDbEllipse *pEllipse;
    acdbOpenObject(pEllipse, ellipseId, AcDb::kForRead);
    // Now project the ellipse onto a plane with a
    // normal of <1, 1, 1>.
    //
    AcDbEllipse *pProjectedCurve;
    pEllipse->getOrthoProjectedCurve(AcGePlane(
        AcGePoint3d::kOrigin, AcGeVector3d(1, 1, 1)),
        (AcDbCurve*&)pProjectedCurve);
    pEllipse->close();
    AcDbObjectId newCurveId;
    addToModelSpace(newCurveId, pProjectedCurve);
}
// Accepts an ellipse object ID, opens the ellipse, and uses
// its getOffsetCurves() member function to create a new
// ellipse that is offset 0.5 drawing units from the
// original ellipse.
//
void
offsetEllipse(AcDbObjectId ellipseId)
{
    AcDbEllipse *pEllipse;
    acdbOpenObject(pEllipse, ellipseId, AcDb::kForRead);
    // Now generate an ellipse offset by 0.5 drawing units.
    //
    AcDbVoidPtrArray curves;
    pEllipse->getOffsetCurves(0.5, curves);
    pEllipse->close();
    AcDbObjectId newCurveId;
    addToModelSpace(newCurveId, (AcDbEntity*)curves[0]);
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 15:29

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部