سؤال لجماعة الرياضيات و الخوارزميات؟ ألدى أحدكم جواب يساعدنا؟

M-Ramy

المشكلة عم تواجهنا أثناء العمل على فضاء ثنائي البعد:
يمكن للمستخدم رسم مضلعات بالماوس على واجهة البرنامج،
المطلوب حالياً: إذا قام المستخدم برسم مضلعين متداخلين أي أحدهما فوق الآخر يجب أن يقوم البرنامج بتقسيم هذين المضلعين إلى عدة مضلعات جزئية لا يتداخل أي منها مع الآخر:
مثال : الدخل:

الخرج يجب أن يكون:

جربت أقلبها على نظرية البيان وحاول أشتغل على الحلقات ضمن البيان(لأنها تمثل المضلعات الجزئية) بس في حالات يصبح هاد الحل غير فعال نهائياً لكثرة عدد الحلقات الممكنة متل هالمثال هاد:

وطبعاً لازم يكون الخرج:

ملاحظة أولى: نقاط التقاطع كلها محسوبة ومعلومة
ملاحظة ثانية: الألوان تمت إضافتها على الرسام للتوضيح يعني ما دخلها Very Happy

فهل لدى أحدكم خوارزمية فعالة أدام الله فضلكم؟


بغداد لا تعجبي فالعرب قد مجنت ** وللمعاصي لـدى الـهيجـاء خـذلان
وكفكفي الدمع إن القوم قد فـسقـوا ** وعـدة الـحرب قـبل السيف إيمــان

خيارات عرض التعليق

اختر الطريقة التي تفضلها لعرض التعليقات، ثم اضغط على "احفظ الإعدادات" لتفعل التغيرات.
strontium90
I remember coming across this topic sometime ago, though I cannot recall specific details now. There's a set of well-known alogrithms dealing with this, and they're collectively known as "polygon clipping" algorithms, so google around for it. There's also a general-purpose C library offering these algorithms, I believe from the University of Manchester CS department, that you might be able to integrate into your Qt/C++ code.
Good luck.

Read the rules
Use the search engine

Believe in healthy, hearty laughter, at the expense of the whole human race, if needs be.
H. Allen Smith

mpcabd

ما قدرت أقرأ خوارزميات ورياضيات وما حاول حللك ياها يا قبطان, هي حلي, بتمنى تقرأوه ويلي عندو ملاحظة يذكرها وانشاء الله يكون صح.

M-Ramy

Thank u guys, this may help, we r using Qt\C++ so thank u again Wink


بغداد لا تعجبي فالعرب قد مجنت ** وللمعاصي لـدى الـهيجـاء خـذلان
وكفكفي الدمع إن القوم قد فـسقـوا ** وعـدة الـحرب قـبل السيف إيمــان

strontium90

كتب M-Ramy:
Thank u guys, this may help, we r using Qt\C++ so thank u again Wink

BTW, are you using Qt 3.x or have you migrated to Qt 4.x already?
Qt 4 has got to be the sexiest application developing framework I've worked with. Cool

Read the rules
Use the search engine

Believe in healthy, hearty laughter, at the expense of the whole human race, if needs be.
H. Allen Smith

M-Ramy

Qt 4.3.2 relly a good framework


بغداد لا تعجبي فالعرب قد مجنت ** وللمعاصي لـدى الـهيجـاء خـذلان
وكفكفي الدمع إن القوم قد فـسقـوا ** وعـدة الـحرب قـبل السيف إيمــان

strontium90

كتب M-Ramy:
Qt 4.3.2 relly a good framework

4.3.2? I thought that the latest Qt 4 release, made earlier this past month, stands at 4.3.1.
I'm glad to hear that, amidst a prevailing .NET syndrome, some industry players realize the potential of Qt.

Read the rules
Use the search engine

Believe in healthy, hearty laughter, at the expense of the whole human race, if needs be.
H. Allen Smith