Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66690

Re: Points along a curve.

$
0
0

just a through.

 

iterating all families and extracting geometry line with intersecting test,then find out all outbound intersected point with them,then determine the "missing" part of the correlative lines.

 

Unfortunately the built-in intersect function(Autodesk.Revit.DB.Line) can't detect outbound intersected point, neither do MS's.

you need implement this approach yourself.

 

There are many samples on internet, I grabbed the following snippet from Qt's library.

 

May It helps.

 

QLineF::IntersectType QLineF::intersect(const QLineF &l, QPointF *intersectionPoint) const
{
    // ipmlementation is based on Graphics Gems III's "Faster Line Segment Intersection"
    const QPointF a = pt2 - pt1;
    const QPointF b = l.pt1 - l.pt2;
    const QPointF c = pt1 - l.pt1;

    const qreal denominator = a.y() * b.x() - a.x() * b.y();
    if (denominator == 0 || !qt_is_finite(denominator))
        return NoIntersection;

    const qreal reciprocal = 1 / denominator;
    const qreal na = (b.y() * c.x() - b.x() * c.y()) * reciprocal;
    if (intersectionPoint)
        *intersectionPoint = pt1 + a * na;

    if (na < 0 || na > 1)
        return UnboundedIntersection;

    const qreal nb = (a.x() * c.y() - a.y() * c.x()) * reciprocal;
    if (nb < 0 || nb > 1)
        return UnboundedIntersection;

    return BoundedIntersection;
}

 


Viewing all articles
Browse latest Browse all 66690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>