cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

c++ I want to get the intersection of intersecting walls. Is there a sample file?

LeeJaeYoung
Virtuoso

I want to get the intersection of intersecting walls.
Is there a sample file?

 

Should I solve it with a code I can find on Google?

 

ex)

 

bool IntersectionLine(Vector2 A1, Vector2 A2, Vector2 B1, Vector2 B2, Vector2 & result)  {

    double t;

    double s;

    double under = (B2.y - B1.y)*(A2.x - A1.x) - (B2.x - B1.x)*(A2.y - A1.y);



    if (under == 0) return false;

    double _t = (B2.x - B1.x)*(A1.y - B1.y) - (B2.y - B1.y)*(A1.x - B1.x);

    double _s = (A2.x - A1.x)*(A1.y - B1.y) - (A2.y - A1.y)*(A1.x - B1.x);



    t = _t / under;

    s = _s / under;

    if (t<0.0 || t>1.0 || s<0.0 || s>1.0) return false;

    if (_t == 0 && _s == 0) return false;

    result.x = (int)(A1.x + t * (double)(A2.x - A1.x));

    result.y = (int)(A1.y + t * (double)(A2.y - A1.y));

    return true;

}

AC27 on window 11
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
LeeJaeYoung
Virtuoso

I changed this code to place windows at intersections. So you don't have to answer this.

 

I want to have permission to delete unanswered questions. ^^

AC27 on window 11

View solution in original post

1 REPLY 1
Solution
LeeJaeYoung
Virtuoso

I changed this code to place windows at intersections. So you don't have to answer this.

 

I want to have permission to delete unanswered questions. ^^

AC27 on window 11

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!