BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

PolyOperations_Example.gsm details

Pertti Paasky
Expert
Hi Graphisoft!
I'm working with exciting PolyOperations_Example object. Cutting polygon with halfplane works fine but when the halfplane is vertical I am in trouble:
what parameters ca,cb and cc should be used in that case?

ca,cb and cc are calculated from the endpoints of the cutting line x1,y1,x2,y2

if abs(x2-x1)>.001 then
k=(y2-y1)/(x2-x1)

! Defining inequality for the half plane: ca * x + cb * y > cc
! line equation
! y-y1>k*(x-x1)
! <=> -k*x+y>-k*x1+y1
k=(y2-y1)/(x2-x1)
ca=-k
cb=1
cc=(y1-k*x1)
endif

code:
......
! ==============================================================================
! Cut "poly3" with halfplane
! ==============================================================================

PREPAREFUNCTION ch, "HalfPlaneParams", "", ca, cb, cc


dim resPolyIDArray[]
numPoly = CALLFUNCTION (ch, "PolyCut", "poly3", resPolyIDArray)
....
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
0 REPLIES 0
Learn and get certified!