Welcome back to our lecture series Math 1050, College Algebra for Students at Southern Utah University. As usual, I'm your professor today, Dr. Andrew Misseldine. This is the first lecture in, well, the first video in lecture 17, which we're gonna talk about quadratic equations. We're going to introduce a couple of different methods for solving quadratic equations, and this will continue on into lecture 18 as well. So stay tuned for that. So what do we mean by, of course, a quadratic equation? We've learned a lot about linear equations, quadratic equations are those of the form ax squared plus bx plus c equals zero, or at least any equation that's equivalent to such a thing. So you could, you could move things around the equation to get it to look like this. So some things to notice here that without the ax squared, this is just a linear equation bx plus c equals zero. So to differentiate between the linear equations we studied before in the quadratic equations, we do have to have that the leading coefficient a right here is non-zero. And this is often referred to as the standard form of quadratic equation. We like the right-hand side to equals zero when we work with quadratic equations. We'll make, we'll explain why that isn't just a second. So some examples like we could take the equation two x squared plus x plus eight equals zero, that's a quadratic equation in standard form, three x squared minus five x equals four. It's a quadratic equation not in standard form though, we have to move the four to the other side to get in the standard form. And then this last one as well, x squared plus x equals negative two x plus five. If you put it in standard form, move everything to the left-hand side, you'll get x squared plus three x minus five when you move the negative two x and the five to the other side. So you can always set this equal to zero to put it in standard form. This is the format that we're gonna want to solve this quadratic equation.  We're just gonna have the quadratic term, the linear term and the constant term, which admittedly some of these coefficients could be zero, you might have no linear term or a constant term, but to be quadratic you have to have the quadratic term, the x squared and nothing else, nothing else more complicated than that. Now the reason we like the standard form of a quadratic equation is because we can solve quadratic equations using the so-called zero product property. When it comes to real numbers or even complex numbers, the only way that a product of two numbers is gonna equal zero is if one of the factors are equal to zero itself. We know that if you take zero times B, that'll equal zero and if you take A times zero that'll equal zero as well. But the thing is the only way a product of two numbers can produce a zero is if one of the factors are zero itself. And so we can solve quadratic equations using principles of factoring. And so in this lecture, as we try to solve quadratic equations, we're mostly gonna be focusing on this factoring method of solving the equations. And so I wanna use examples to help us practice factoring techniques. So for example, if we look at this one right here, x squared plus two x, whenever you're factoring anything, whether it's a quadratic polynomial or any algebraic expression, the first thing you always wanna look for is the GCD, the greatest common divisor. Look for common factors amongst the terms and then factor them out if you can find them. So if you look at like x squared and a two x, notice they have a common factor of x. So we're gonna factor this x out of the binomial there. And so this is gonna give us x times x plus two, which is equal to zero. And if you have any doubt about whether you have the right factorization or not, you can always multiply it back through, right? Factoring is basically just the opposite of the distributive property, we're just reversing it, okay? And so if you redistribute the x, you'll get x times x, which is an x squared, and then an x times two, which is a two x. This is a correct factorization. Now by the zero product property, or zip or zapper, put whatever vowel sound you want in there, but by zip, we see that the only way this factorization could equal zero is if one of the factors were zero. So it must either be that x is zero or x plus two is zero. Now if x is zero, then we know what x is, but if x plus two is zero, you could subtract two from both sides and get that x equals negative two. And so it's quite typical for a quadratic equation to have two distinct solutions. You get x equals zero and x equals negative two. And we can check the original expression just to make sure here, but if you plug in zero, you're gonna get zero squared plus two times zero. That'll give you zero plus zero is equal to zero, that passes off. If you try negative two, you're gonna get negative two squared plus two times negative two. Now notice negative two squared is actually a positive four because you get negative two times negative two, it's double negative, but then you're gonna get two times negative two, which is negative four, which adds up to be zero as well. So both of these numbers do in fact work. Now one thing I wanna be clear about the zero product property is that the product equals zero only if one of the factors is zero. And so we end up with things like x equals zero and x equals negative two. I'm not saying that x equals zero and x equals negative two. It can't be both numbers simultaneously, but as the numbers are variables, I mean, that's what variable means. It's able to vary. There are different choices we can make for x. And if we choose x equals zero, that is a solution. If we choose x is negative two, that's a solution. And any other choice of x would be a non-solution. But when it's not, I'm not saying that x is simultaneously zero and negative two, that's not a possibility. But these are the only two choices of x that will solve the equation. And we found this using this zero product property that is zipp zippity-zoop.


I have the greatest pleasure in introducing the moderator for our next session, the former British ambassador to Cairo, Cedric Plumlee. What we had our very first conference in 2006, Cedric was the ambassador there and very kindly launched the book on our conference in the embassy the following year, just before he stepped down. This session is called Reflections on the 1919 Independence Movement. Ladies and gentlemen, Cedric Plumlee. Thank you Noel. It's good to be back, addressing another major Egyptian marker in time, so to speak. And thanks very much to the Middle East Institute and all the rest of you for organising this. It's my privilege and we're running a little late so I won't speak at enormous length, but to open this session and to welcome Munir Thakri Abdel Nour, who is our next speaker. He's a friend, I guess he's a friend of quite a few people in this room, and he has had a very distinguished career as a banker, as an entrepreneur, as a politician. He was a secretary general of the new WAF party in the 2000s as a minister. He was a minister of tourism, after what I will call the January 2011 revolution, and he was a minister again of trade, industry and investment from 2013 to 2015. Like one or two others in this room, and I can look around and I can see them, he has family connections for a family link to the subject that we're discussing today, the 1919 revolution, and the turbulent events that occurred after that up to 1925. His grandfather Thakri Abdel Nour was an activist, a leader amongst the leaders of the nationalist movement. He became close to Saad. He was imprisoned in 1922 by our four fathers, and he went on to write his memoirs, which are a massive work which was introduced by Mustafa Amin, who was the doyen, I suppose really, of Egyptian journalists and editors in the 20th century, and who had grown up in the home of Saad Zaglul, and Mustafa Amin called Thakri Abdel Nour a new gibberty. I like the gibberty who'd described the Napoleon's adventures in Egypt in similar chronicling form. Munir is a prime mover behind the things that are happening in Egypt to mark the 100th anniversary of the revolution. And I know he has been very keen to link that commemoration, so to speak, with whatever was happening here, which seems to me, since this is very much an Anglo-Egyptian story, important. He's promised to tell us a little bit about those events, but his theme, as you know, and he's written a long paper on the subject, is Copts in the 1919 Revolution, an exceptional participation in Egyptian political life. And he's going to summarize that for us, I think, really, and speak to the main themes thereof. And we will be returning to the subject I notice again tomorrow afternoon, so it repeats itself. It's important. The Copts are Christians, who knows, because there isn't a precise figure, but 10% roughly of the population of Egypt. But politically, they have rarely pulled their full weight on, even that weighty, even, on the Egyptian political stage. The focus before the First World War, immediately before it, was very much on Coptic grievances and who were crystallized in the a conference that was held in Asyut in 1911, when they set out demands, which were not well received by the British, I have to say, or at least my old engorst. And afterwards, the theme has recurred from time to time in Egyptian political life, and Menir, in fact, is a symbol in one way of this, because he is actually one of the few Copts to be directly elected in recent decades to the Egyptian parliament, which is not to say that there are not. Another one is in the audience, actually, we are doing really well. Yes, exactly. But there aren't very many such people. Anyway, 1919 to 24, 25 is a very different story. Copts are amongst the leaders of the nationalist movement. The cross and the crescent became the flag of the revolution. There were meetings in mosques and churches and priests in imams were seen holding hands and making speeches together. It was a different message, a message of al-wahda al-wataniya, which has continued, actually the images at least, have continued to resonate in Egyptian politics since then, really countering, it seems to me, some of the negatives that I've already mentioned. But it's not for me to describe all of that. It's for Menir, who knows the subject intimately, and he's going to tell us just how different it was and what happened and why, and then we can do Q&A. Thank you. Thank you, Derek, for this introduction. Let me warn you, I'm not a historian. I'm not an academic. I'm merely an evident reader of contemporary Egyptian history and a born of this. So I think I know my subject and I'll try to relate to you my opinions. I thank you very much for inviting me to attend this conference. It is an honor for me to be in this distinguished assembly, and it's a great opportunity to meet friends I haven't seen for quite a while. For us, it is a very important event, the celebration of the centennial of the 1919 revolution. And we made it a point to celebrate it if only to remind Egyptians of the values of this movement that has called for independence, democracy, respect for the constitution, for the rule of law, and for secularism. It's a movement that has witnessed the birth of the Egyptian feminist movement and the renaissance of fine arts. And this is why the Ministry of Culture has organized an international conference that was held in Cairo between the 16th and 18th of March that was extremely well attended by scholars, politicians. Apparently there are several events that have been organized, including exhibitions of fine arts, photography, music, all related to the 1919 revolution. I must also tell you that by Malem who's here has published a series of books, all books concerning the 1919 revolution. All universities, all universities in Egypt have celebrated this event. The Waft party, of course, is doing his job. And at the end of the year, Bibliotheque Alexandrina is organizing a conference that will focus on the influence of the 1919 revolution regionally in neighboring countries, Sudan, Iraq, Palestine, Syria, and the Maghrib. And also the relations between the Egyptian independence movements and other movements, including, by the way, Ireland, as you know, as you might know, Sazerlul had a correspondence with de Valera and in order to coordinate their fight against the British Empire, the British rule. The conference also is going to discuss the relationship of the 1919 revolution and its influence on the Congress party, more specifically on Mahatma Gandhi in particular who was admiring Sazerlul and thought that Sazerlul succeeded to unify Egyptians in their quest for independence, whereas he personally failed to unify Indians of different creeds. And in fact, the active participation of cops alongside the Muslim countrymen during the five-year period is precisely the subject of my talk to you. But what I'm going to talk about is the contrast between what happened those five years and the place of cops in Egyptian politics and public life in previous and subsequent periods. The contrast is huge and it raises questions how and why. Why was it that way in 1919 and it wasn't neither before nor after. I'll attempt to answer the question but let me start from the beginning very quickly and very briefly. Through the 18th century and the beginning of the 19th and even during the enlightened rule of Muhammad Ali, cops were zimmers. They used to pay the jizya in return of which they were exempt from conscription in the army. Exceptionally, individuals were accepted in the administration and raised in the Egyptian bureaucracy and held important positions such as Gurgis and Ibrahim Egory, the two brothers, and Mahallem Ghali during the rule of Muhammad Ali. But starting the second half of the 19th century, cops started to recoup progressively their citizenship rights. In 1854, Said Pasha, the first son of Muhammad Ali, issued a decree abolishing the jizya and as a result cops were admitted in the army as soldiers and he issued a second decree giving the ownership rights to the peasants ownership rights on the land and as a result cops started to own agriculture land. Under the Kiribis Ma'il, cops were allowed to enter state schools to be sent abroad to study at the expense of the state, then were accepted as officers in the army, it was a big big step, and in 1866 were appointed in the chamber of notables precisely what is called Maghlish which is the first attempt to have a parliament in contemporary Egyptian history. Two cops were appointed, by the way, I have a long, the paper is much longer than what I'll say verbally and all the names are in the paper. In 1882, cops like the patriarch supported the Arab revolt and rallied around the slogan Egypt for Egyptians, and as you know the revolt ended up by the British occupation of the country. In 1893 under the reign of Kedif Abbas Helmi, the first coped, I mean coped, not Christian, was named minister, it was Butros Gali who was named minister of finance, later he was appointed minister of foreign affairs, in 1908 he was prime minister. During the reign of Abbas Helmi the public debate flourished, in 1913 there were 282 newspapers published in Egypt. Among those newspapers there were two Coptic newspapers, Mish and Erotan, but they did not really, they were not active in the public debate, they concentrated on Coptic issues, grievances, demands and so on. At the same time several political parties were formed, again cops were not stimulated by the political parties. We saw as if a prominent cop joined Hezbel Watani, but Hezbel Watani that was formed by Mustafa Kamil, but had cold feet when this party started to use fanatic discourse, very Pan-Islamist and so on. On the other hand, rich Coptic landowners from upper Egypt joined Hezbel Oma, Hezbel Oma that was the panseur behind Hezbel Oma was Ahmad, would we say it, the architect of Egyptian liberalism. A number of rich landowners joined Hezbel Oma, but were never active, really active in the organization of the party or on the political scene. Names like Bushra and Sinot Hanna, by the way Sinot Hanna is an important name that will follow through the five years, the Andraus Bishara and Fakhre Abdu Noor, who was one of the founders of El-Garida which is the newspaper behind that political party. In 1913, Abbas Hidmi signed an organic law to establish a legislative assembly, El-Gamaya Tashriaya. Four cops were appointed, one of them was again Sinot Hanna. In July 1914, the war erupted, the legislative assembly was suspended, martial law proclaimed and on December 18th the British government declared Egypt a British protectorate. A chapter in the history of the country was turned during which cops succeeded to regain most of the citizenship rights. However, with the exception of a few individuals, cops did not participate in the political and public life of Egypt. They were marginalized. In fact, they sidelined themselves. They felt alien when Egypt was part of the Ottoman Empire and when the national movement promoted Pan-Islamism and did not really get involved in the public debate or in the national debate. When the Coptic intelligentsia in November 1918 got to know about the meeting between Saad Zarul and Abdulaziz Fahmi and Met Regional Wingut to ask for to participate in Versailles conference and Saad Zarul was forming the waft. They noticed that there were no Coptic names in the waft. Three of them, three of those intelligentsia, namely Wisa Wasif, Taufi Andraus and Fahri Abdul Noor, went to meet Saad Zarul to tell him in so many words that nationalism is not or should not be monopolized by Muslims. And they proposed to have the name of Wasif Boutros Ghali included in the waft. Saad Zarul welcomed this proposition, included in the waft Wasif Boutros Ghali and in addition included Sinot Hanna and George Chayat. Before taking the oath, George Chayat asked point blank Saad Zarul what is the position of Coptes in that new order and that new independent Egypt. Saad Zarul told him they have equivalent rights and equivalent obligations like Muslims. Suddenly everything changed. Coptes rose to the front lines of political and public life of Egypt. When the revolution erupted when Saad Zarul was exiled on March the 9th, Coptes were in the front line of three demonstrations. As a matter of fact, the first casualty that was killed was a young Coptic student by the name of Mehir Hafiz Amin. When Saad Zarul was released and traveled to France with hoping to participate in the peace conference, he was joined by Wasif Boutros Ghali, Sinot Hanna, Gorgi Chayat, Wisa Wasif, Aziz Mansi, George Domani, and they were there, they were present and stayed with him. When the government employees decided to have a general strike, the leaders of the general strike were Sada Henein from the Minister of Agriculture, Dr. Nagib Eskander from the Ministry of Health, the Judge Salama Mikhail, a judge representing the Ministry of... In April 19, Coptes rushed to participate in the Waft Central Committee that was formed to liaise between the leadership and the members of the Waft and the leaders of the leaders, the Coptic leaders that went into that Central Committee, where Mour Oshanna, Tafiq Dos, Kamil Boutros, Habib Chayat, Fahmi Wisa, and many, many other names. Later, in April 1921, two years later, when the Prime Minister Adliyakar objected to the organization by the government employees of Reception to honour Saad Zarul, who arrived after two years of absence between Paris and London, it was again Sada Henein, Salama Mikhail, Nagib Eskander, and Makram Ibeid, who challenged the Prime Minister. In fact, the reception took place, but the organizers were tried by the disciplinary court. Coptes were again in the front lines to welcome Saad Zarul when he took that trip to Upper Egypt and despite the very heavy hand of the police and of the administration, they were there everywhere in Minya, in Assout, in Sohaq, in Gerga, and so on. They were in the front lines to receive Saad Zarul and they were there to bear the consequences of their enthusiasm. Sinot Hanna and Makram Ibeid were exiled to Saad Zarul, to Seishel, and then Saad Zarul to Gibraltar. Wasif Ghalimur Oshanna, Wisa Wasif, George Chayat were tried and sentenced with Hamid al-Basil, Salama Mikhail, Raab Eskander, and Fakhla Abdu-Noor were arrested and jailed with al-Maslisadi in July 1922. Between May and June 1923, when the leaders of the waft were released, coming back from jail, from the exile, the High Committee of the Waft was constituted and it was constituted of 26 members, nine of which were cops, nine out of 26. But cops were also the most active and probably the most competent when it had to do with contacts with foreigners. In Paris in 1919, Wasif Ghali, Sinot Hanna, and Wisa Wasif, the three of them perfect francophone, contacted the French press, the opinion leaders such as Anatole France and many others. They wrote articles that were published in La Revue des Domains in Le Journal and with a view to raise the attention of the French public opinion around the Egyptian problem. In fact, they also wrote letters to Georges Clemenceau who was prime minister and obviously the letter was signed by Saad Zarul but Clemenceau never answered. And they succeeded to get the support of part of the French press, mainly the socialist press and in particular of l'humanité and of le populaire supporting the Egyptian cause. Similarly, it was Macron Abid who went to, in 1921, to England to follow up on the negotiations between Adliak and Lord Curzon, the Secretary of State for Foreign Affairs. And while there, he also contacted opinion leaders, writers and politicians from both the Liberal and the Liberal Party. He published articles mainly in the Daily Herald, among many other newspapers, and he was in close contact with journalists and writers including George Bernard Shaw. It was Fahri Abdel Nour suggested to Saad Zarul on the 14th of July 1921 on the occasion of the French National Day to go to attend, to crash, as a matter of fact, the reception to send a message to the foreigners in Egypt that the Egyptian national movement was neither fanatic nor xenophobic and the message was that it will preserve the interests of foreigners in Egypt. It was, finally, it was Sinotana and Morosana who received and invited the Liberal members of the British Parliament who arrived in Egypt in September 1921 on a fact-finding mission at the instigation of Macron Abid who was there, who was then in England. And cops were definitely the most faithful to the cause and to Zarul personally. I mean, each time that was, there was a problem and a problem between the members of the waft, they stood by Zarul. It was the case when members of the waft in Paris disappointed by the recognition of Woodrow Wilson of the British Protectorate over Egypt disappointed a lot of the members left, the one who stood where the cops with Saad. Again in 1920, after the negotiations between Zarul and Lord Milner in London broke, disappointed the members left, the cops remained with Zarul in London and back to Paris. Precisely it was Wasafrili and Sinotana together with Ali Mehre. When the controversy started within the waft in Cairo, around the presidency of the delegation to negotiate with Lord Curzel and the choice was between Adiak and the prime minister and Zarul insisted to be the negotiator because he had the mandate from the people and he was preserving the right of the people to speak and to have a position. Members of the waft left and those who stood by Saad were again the cops in addition to Nahas. And cops were the most extremists and I'm using the words used by the British, I mean this is the British description. They were the extremists and I take as an example Sinotana in particular who was writing articles in the newspapers. Strangely enough in the Coptic newspaper that used to be a Coptic newspaper, the MISR and who used to concentrate on Coptic issues and Coptic affairs suddenly had become the mouthpiece of the waft of the national movement. Sinotana started to accuse and attack the prime minister Mohamed Said because he was taking legal measures against government employees who led the strike, the general strike in April 1919. So he accused him and wrote an article titled in the Atahem copying Jacques of Emile Zola and to the point that Said had to resign. He accused he attacked also the successor of Mohamed Said and successor Mohamed Said was a Coptic prime minister Yusuf Wahaba because Yusuf Wahaba was ready to receive Lord Milner in Cairo whereas the national movement had decided to boycott the Milner delegation and he attacked Yusuf Wahaba vehemently and in a series of articles titled Erwatanea dinuna war istaklal hayatuna meaning patriotism is our religion and independence is our life. I mean the the his speech was so inflammatory that it inspired a young Coptic student Elian Yusuf Sa'at to attempt to assassinate Yusuf Wahaba. In July 1920 Abdelahman Fahmi who was the Secretary General of the Central Committee of the Waft was accused of was arrested and charged with conspiracy of attempting to overthrow the government. He was tried along with nine other Coptes. In return Zaghloul showed his appreciation and expressed his gratitude to Coptes in many ways. It is true when they came to propose to include Wasafradi not only he welcomed Wasafradi but he included Sinod Hanna and George Hayat but after two years of absence between Paris and London when Zaghloul came back the first thing he did on April the 6th 1921 is to visit the tomb of a Coptic nationalist who had succumbed to the bullets of the police during demonstrations. On April 7 he visited the Coptic Patriarch Patriarch Kirolis V. In May on the occasion of Easter Zaghloul visited the tomb of Bothra's Basha Rally then went to greet Coptic leaders of the Waft in their houses to wish them a happy Easter. In September 1921 he attended the wedding of Yusuf Bothra's Rally the brother of Wasafradi and the grandfather of this one of this Yusuf Bothra's Rally wedding that was attended by the liberal MPs visiting Egypt. Later in September Zaghloul presided over a ceremony on the occasion of the Coptic New Year he then narrows and he delivered a speech emphasizing the importance of unity of unity between Coptes and Muslim. In December 1923 while preparing for the parliamentary elections Zaghloul was very worried that his Coptic colleagues would not succeed would not make it in the elections and asked Sheikh Mustafa Iyati to go and support Sirot Hanna in Asyut, Fahri Abdel Noor in Gerga and Makram Abid in Qina to support them in face of potential fanatic Islamic claims. In the parliamentary elections 16 Coptes won seats out of 214 some of them in entirely Muslim constituency. A far cry from previous periods when they had to be appointed as representative of minority. In fact they were not perceived as minority anymore. Finally once Zaghloul formed his cabinet in January 1924 he appointed two Coptic ministers Wasafradi as Minister for Affairs and Moros Hanna as Minister of Public Works not withstanding King for Ads Reservation who reminded him that customs entitled Coptes to only one ministerial post. But Zaghloul appreciation and recognition of Coptes role in the revolts cannot have been the only reason for Coptic enthusiasm and involvement in political and public life of the country. Some argue that Coptes were particularly active during this period because they resented the fact that the British didn't sympathize with them as a minority. And there is truth to the British lack of sympathy for Coptes as illustrated by Edward Lane the famous orientalist who and the writer of the famous book Modern Egyptians an account of the manners and custom of modern Egyptians. Lane was extremely harsh describing Coptes. I'm quoting one of the most remarkable traits in the character of Coptes is their bigotry. They bear a bitter hatred to all other Christians. They are generally speaking of a silent temper extremely avaricious and abominable dissemblers, liars. Unfortunately Lane's defamation of the Coptes has been passed on to innumerable Britons who came after him including Lord Cromer, Eldon Gorse. I guess Derek Plumbly is an exception since he married a Copt, but anyhow. Dr. Butler, Dr. Alfred Butler the historian, the author of The Arab Conquest of Egypt, confirmed in his introduction to Kirakus Mikhail 1911 book Coptes and Muslims under British control that policies and practices of the British government in Egypt favored Muslims at the expense of Coptes. It is likely that Coptes' active participation in the fight for independence was a reaction to the lack of British empathy for them. But the most important factor I believe that traced Coptic enthusiasm for the national movement was the secular character of the 1919 revolution. A secular character that emphasized the unity of all Egyptians regardless of ethnicity or religion. It was I believe the definition and clear formulation and expression of the Egyptian identity that was the major reason for the active involvement of Coptes in the political life of the country. In fact, since the beginning of the 19th century Egypt was in search of its own identity. Under Muhammad Ali, Said and Ismail Egypt wanted Egypt wanted to affirm its own identity away from the Ottoman Empire, but it failed because the balance of power was not in its favor. Then in 1882 although the Arab Revolt raised the slogan Egypt for Egyptian, it was unable to properly express Egyptian nationalism and lost its way due to xenophobic sentiments. Then came Mustafa Kamil and here I guess I'm answering the question that was raised earlier. Then came Mustafa Kamil who in order to safeguard Egypt's independence vis-à-vis the British colonialists promoted Egypt's allegiance to the Ottoman Empire and his successors promoted Pan-Islamism. In contrast to those movements, the waft inherited the secular and liberal thoughts of Hezbollah. And like Lotfi Said strongly believed that Egypt is a nation by itself, Egypt is Egyptian. The discovery of the tomb of Tutankhamun in 1922 helped foster Egyptian identity and gave rise to a movement of pharaohism which became a manifestation of Egyptian nationalism. Coptes claiming to be the direct descendants of pharaohs had to be at the vanguard of this movement which portrayed Egypt as a Mediterranean nation with links to Europe. Later through the 20th century several events contributed to reinforcement of the Pan-Arab and Pan-Islamist political forces and changed the course of the Egyptian national movement. In the 1930s the nationalistic and fascistic young Egypt society led by Ahmad Hussain while advocating British withdrawal from Egypt and the Sudan promised to unite the Arab world under the leadership of Egypt. At the same time pharaohism was condemned by Hassan el-Banna the founder of the Muslim Brotherhood whose doctrine like it was said earlier whose doctrine does not recognize nation states and aims at unifying Muslim countries under the Islamic rule based on Quran and Sharia. After 1952 Nasser played up Egypt's Arab identity and promoted the policy of Pan-Arabism arguing that Egypt that all Arab states should unite under his leadership to face the political and economic threats of imperialism. Nasser's successor Anor Sadat confronted by Nasser's and communist challenges relied on the support of various Islamic movements. He promoted Egypt's Muslim identity in 1980 he amended the constitution promulgated in 1971 to stipulate that Sharia law is the main source of legislation under his rule Saudi Arabian influence of dominated media and public education it had a deep impact on Egyptian culture to the point that Islam was portrayed as the cornerstone of Egyptian identity and once again cops were sidelined from political from the political realm. In conclusion I would argue that throughout the years cops have only been inspired and motivated by secular movements based on Egyptian nationalism and Egyptian identity. The political and cultural environment of the period going from November 1918 to January 1924 encouraged Egyptian to raise the secular slogan religion is for God and the nation is for all Deenullah it had the extraordinary effect of pushing cops out of the sidelines to the forefront of the political and public life in Egypt. This made this period a unique one in contemporary Egyptian history. Thank you. I will then ask you a question. Do that. I have two. One is why did you choose the subject and what is it particularly that drove you to this and secondly I'm if we're looking at the broader picture I mean you're saying only in the context of this purely secular as it was almost political environment was this degree of participation possible aren't you actually rather writing cops out of political life in Egypt when maybe more compromises had to be made. Now let me answer the second question. No I'm not writing off cops when I'm talking of Coptic participation I'm talking of the community participation I'm not talking of individuals. Individuals were always there. Was it window dressing or was it the again the rise of a competent person within the administration within the bureaucracy it was before and after it was never the participation of a full community in the streets in the government in the political parties in the political forces in literature in fine arts in cinema in I mean everywhere look at it has changed and it has changed I think it is the result of lack of secularism again I repeat cops in general it's not necessarily my opinion I'm just describing what has happened and what is happening they are not enthusiastic when you're talking of pan islamism they feel left apart and they are very doubtful when you're talking of pan Arabism they are not sure or it is not the majority of cops they believe that they are Arabs it's a fact why did I choose this subject I've always been struck by the facts of this active participation during that period and then when you look around for instance there was a comparison between 1919-1952 in 1952 the revolution started by a coup d'etat made by army officers and it was the three officers Zubat al-Ahra they were 400 none of them was a cop I mean something is wrong something has changed I'm sorry something has changed and this is precisely what I'm trying to emphasize and this change has sidelined the cops from the political life yeah they might be brilliant businessmen they might be excellent traders they could be they could be good diplomats but they out they are out of political life they can have brilliant minister of finance possible but but they are not in political life and if they are their exception it would be an exception Dr. Mengti thank you very much do you believe that I'm a cop myself like you but didn't you believe there is an element of what I call Coptic apathy to participate in political life and activity to be blamed and would you agree with me that the great party of what party was basically near the end before the 1953 revolution was nearly destroyed by a cop as well I misheard the last part of the question can you repeat it please raise your voice dr. Magdi because I'm okay I have a problem no I'm taking about the great waft party near the end the difference between one single coped and Nakhaz Basha have led reality to the mice of the waft party possible of course mind you I'm I'm talking about a five year period I didn't go any further because starting the 1930s the mood changed the mood changed and when makram left the waft I'm sorry it did destroy the waft it did destroy the waft because the the message itself was destroyed and the message disappeared now you're talking about apathy yeah maybe I mean they were not invited and they they they did not invite they were not invited in the political realm and they they they did not fight to get into that political realm thank you um thanks you mentioned the patriotism is it on you mentioned the patriarch only once in your presentation and were you two have discussed events in 2011 or 2013 presumably that figure would have come up more frequently and I wonder therefore if you could address the role of the patriarch and the the institution of the Coptic church in your five-year period as compared to the present day thank you for your question first of all since you mentioned 2011 and 2013 uh because I wanted to save time so I just skipped a page but if I have to be fair I would tell you that cops were present in 2011 revolution or whatever you want to call it they were there they were in the streets despite the fact that the patriarch uh Pope Shenoula with who's who's was a huge man I mean a very strong personality uh asked cops not to get involved and nothing doing they were there in the street but I mean it was such a short period that uh I would not and it would not overrule what I'm saying that the five years between 18 and 24 is an exceptional period and it was never repeated it was very very short uh the the patriarch the patriarch Kirolos uh the the patriarch of the 1919 revolution uh was very much no no I'm talking of the fifth I'm talking of the fifth Kirolos the fifth of the 1919 evolution was very very close to Sadzach rule as a matter of fact as a matter of fact they died the same year in 1927 and they were very close and the visits the visit I mentioned one visit to Sadzach rule to the patriarch he visited him several times uh it was the same yeah it was the same patriarch who supported uh uh the the arabi revolt in 1882 but the character of the church was somewhat different wasn't I think in terms of its authority and the relative weight between the the the the leaders of the community the leaders the leaders of the leaders of the community yeah the the leaders of the community then mind you it was the church was a poor church and it was led it's a question of financial ability and it was led by uh the civilians uh uh the the the the cop this the coptic leaders the civilian coptic leaders it's not the case today today the coptic church is a rich uh church as a result of uh the the coptic diaspora and uh obviously it gives much more weight to the coptic nomenclatura church nomenclatura I think honestly I'm receiving strong signals from uh the floor here that we're going to miss lunch if we get uh if we actually extend further one question one question one question okay that uh gentleman yeah okay that's it and then we're just intrigued and I am not um disputing the fact uh about the marginalizing of the cops uh after 1952 however the pan arabism at least from the levant was actually a movement by the christian anti-pan islamism absolutely and in a way in nasser after the first period was fighting the pan islamism view and concentrating more on pan arabism and both were defeated later but uh why is it that the cops of egypt did not link the same ideas that came from syria lebanon and whatever you know the you know the answer the national movements in the levant was against the Ottoman empire was against the caliphate so uh uh their their claim was the pan arabism as opposed to the pan islamism and pan egyptianism if you want to 1919 the the the the egyptian national movement was facing the the the the british empire it was not facing at all the uh the the ottoman empire and and in face of the the british empire it was egyptianism that was uh put uh i mean that was the claim but it's not only i'm sorry about that macramar bedan his fight that have destroyed the relationship from 1930 till 1952 this was a prelude to putting the egyptian cops outside the political spectrum so what has happened briefly in that period to marginalize i think honestly we will have several several things i mentioned i mentioned the the rise of the muslim brotherhood i mentioned the rise of the fascist movement of muslim fatah and uh if you are here tomorrow we can come to this we have another session with another speaker on the whole question of goptic identity and minority identity so thank you very much it was amazing


Welcome back CAD from scratch episode 15. The topic today is triangle intersections in three dimensions And so this is an extremely important fundamental topic. It's the basis of almost everything of value in computational geometry. It's in CAD obviously Rendering it's used for collision detection and even where it's not used the geometric Predicates or concepts that these algorithms are based on They apply and just having watched this video. I think you'll not only have a Better understanding of what's happening under the hood when you play certain games or make something in CAD But you'll also have greater appreciation of how much goes into it. You know, it's not just simple You know dot products was quite a bit involved in the computations here And it's surprising to me how few comprehensive resources there actually are on this topic because honestly, there aren't any and It's not any textbooks that I've seen. It's not in any MIT open courseware syllabus Most of the papers, especially on quantification here. They're paywalled Most of the open source code is, you know, obfuscated or very hard to understand There are a few really good papers that are sort of free to access about classification Especially paper by Tomas Moller. I don't have it written down here and then paper here by Olivier and Philippe It's an awesome paper. They have a great and they have a really good very Efficient algorithm to classify intersections very very good But even their paper has a really bad typo that took me like honestly hours to figure out that it even was there And it has a huge impact on how this works. So What I'm trying to say is This video is a synthesis of like four or five hard to find hard to understand resources Plus some geometry and matrix algebra stuff of varying difficulties. So this video in the code to go along with it is Definitely like a one-of-a-kind resource that I I genuinely hope is useful to at least one other person besides me So without further ado, I'm gonna first talk about the math the geometry the algorithms Then I'm I'm not gonna do any live coding today. Like I usually do. There's just too much and I would make a hundred mistakes I have the code already written, which I'll just go through and show how we're implementing each of the algorithms So let's begin so when it comes to these intersections, you have to first classify it So you have to see if for any two different triangles if they a Don't intersect if they're far apart, right? That's the most common case Then B if they do intersect for example like shown here the yellow and red triangles intersect in a single line segment in pink Or C to absolutely the worst case if they intersect in our coplanar That's you know, you can imagine like a triangle is intersecting like this in this boundary here That would be a coplanar intersection. That's the terrible case. Unfortunately, though It's a very common case, especially when you're working with you know primitives with flat faces like prisms cubes Stuff like that, you know and extrusions and stuff you have this all the time And it's just a an absolute mess if you can't do it properly So that's the classification after that once you kind of determine what's going on in the triangles Get people to figure out where it's going on. So where where does the injection occur? Where is this line segment? That's not as easy as it would sound. It's actually a lot harder than classification. So we'll get into all this So what is the fastest classification algorithm? Now this is gonna be the fastest overall. It's the fastest one that I'm aware of It has three different steps. So step a Is to check if the triangle bounding box is overlap This is how you can filter out, you know, the vast majority of Faces that just don't intersect So what it's a triangle bounding box a bounding box is basically the box that surrounds The triangle and goes from the minimum to the maximum coordinate in the x, y and z direction And so basically if you have two triangles with bunny boxes that don't even touch Then you can say for certain that they don't intersect If the boxes do overlap, however, you may possibly have intersections for the triangles Phase step B What are these signed distances from triangle ones vertices to triangle twos plane and vice versa? So basically we're trying to figure out if the distances from triangle ones plane triangle two vertices and vice versa if they're all Positive or all negative and I'll get into details later about what goes on for each of these is just me talking sort of a top-level discussion right now If they're all positive or all negative, there's no intersection if they're all zero Obviously you have coplanar intersection And now if some are positive and somewhere negative That would mean that Triangle one vertices are split across the plane of triangle T2 In that case you may have intersection in that case the third step step C applies so That's basically if the triangle planes intersect along a line called line L Does the interval of intersection of triangle one in L? overlap the interval of intersection of triangle two in L if So you definitely have intersection if not you do not have intersection and these three steps are sort of Set up in a way that you can fill throughout most of the cases with the least amount of Operations so you do a first and then B and then C because C is the most involved B is the next most involved and a is the easiest so that that's why you do a B and C in that order and the the benefit of what Olivia and Philippe came up with in their paper is using a determinant either a four by four determinant or a three by three reduction of that determinant to evaluate something so basically You take this kind of weird triple product of some coordinates here and It has a couple different Interpretation so basically This determinant here will evaluate to positive if the a2 vertex is Above plane a1 b1 c1 it will like negative if it's net if it's below the plane And I wait to zero if it's in plane so you can imagine how that would be useful for example to figure out this step B Right because that's exactly how you would compute these quantities is with that determinant so the other interpretation that which is harder to understand but Equally relevant is basically this determinant would be positive if the screw around ray a1 to b1 turns toward Ray c1 to a to a2 Negative if it turns the other way and zero again if your coplanar and there's nothing to talk about So if that doesn't make sense, don't worry the first one should make sense That's one that's that matters more this one is sort of the extra extra credit if that would make sense That's great as well So for phase a this is about the triangle bounding boxes overlapping So basically it's pretty simple. We will have to encode basically these Minimum maximum coordinates in x y and z for each triangle We can save that in the same structure that we use to encode the faces and their their own nodes and things like that That'll be part of you know our data structure and basically you can compute these six Expressions basically if any minimum value for a triangle exceeds the maximum value of the other triangles bounding box Then you cannot have intersections Only if all these tests fail Then you can possibly have intersections And that's why you always want to do this test first because you can throw away 99% of all You know triangle intersection possible cases with this very simple test if any one of these fails You can immediately say no intersection So it could be a single operation. It could be two. It could be three whatever. You'll be very quickly Go very quickly be able to figure out if they intersect or not so phase B this one is the Computation of the sine distances from triangle one to triangle two. So imagine you're looking down the edge of Triangle one from its side. So it's just a single line like this basically normal points out of that face now if you have Triangle twos where it sees like this where you may have two on the top one on the bottom Or one on the top and two on the bottom if that is the case where you have some Vertices above and some vertices below the plane of triangle t1 Then you can possibly have intersection, but you can imagine if this vertex here was actually up here You're trying to look like this Then you you obviously could not have intersection because all the vertices are you know above triangle t1 So basically you can use those determinants Here y1 y2 and y3 to compute whether or not triangle T twos where to see is here a2 b2 and c2 if they are above the plane defined by a1 b1 and c1 so if If y1 y2 and y3 have the same sign, there's no intersection And if y1 y2 and y3 are all zero that would mean that triangle t2 is sort of Coincidence at least in the plane of triangle t1 So they would be coplanar So after that if neither of those two is is it is been evaluated as true Then look at why 4 by 5 and 6 so why 4 5 and 6 are basically the opposite So this is triangle t1's vertices a1 b1 and c1 relative to the plane a2 b2 c2 Which is triangle twos plane so you can evaluate that again So if y4 5 and 6 have the same sign then you have no intersection and If y4 5 and 6 are zero again your coplanar, but this would already be true You would have already evaluated this so this is not even important to keep as a as a possible test You can keep it if you'd like, but it will always evaluate here not here And of course you can't use your you have to use a tolerance because you can't use like you know exactly zero in Computing like this, but some small tolerance would be fine Now finally is phase C. This is like the the real last chance for Intersection to occur between triangles At least in the general sense not in a coplanar sense. So basically is it's asking and do the intersection intervals Overlap. So what does that mean? So triangle one here is in is in teal and triangle two here is in green and The plane of triangle t1 and t2 intersects in this line L in pink Now we're triangle t1 Intersects L which is guaranteed to do because it's defined by the plane of triangle t1 and t2 So we're t1 crosses line L. You have some interval here shown in this pink color same in color and We're triangle t2 crosses L. You have this interval in this same in color And if those two intervals overlap, then you have intersection guaranteed. That's the final test However, if you can imagine triangle t2 was over here and the interval for intersection was you know over here Then you can say that this interval on t2 does not overlap this long interval on t1 And therefore the triangles do not intersect That makes sense it should so basically if you kind of can Set it up like this it will make computational sense so if you can call the loan Vertex from triangle t1 on its own side of the plane of triangle t2 a1 So basically what I'm saying is if you have this view here from the side of triangle t1 This here would be point a2 and then in the opposite case where this is green and this one is blue This point would be triangle a1 The loan vertex is called a If you call it a a1 and a2 respectively then you can evaluate intersections of these sort of line segments with line L So for example where a1 b1 Crosses line L that is point i and where a1 c1 crosses L that is point j a2 b2 that's point k a2 c2 That's point L And remember L is oriented obviously to n1 cross n2 and one being normal of triangle t1 and To be normal of triangle t2 So basically the way this works is you do a simple min max evaluation and if that min max evaluation Evaluates a certain way you can say that Interaction occurs or not because the intervals overlap or do not so in this case You're looking if the minimum value from sort of you know in this sense looking from this point In pink here outwards along line L is the minimum of ij less than the maximum of lk And is the minimum of lk less than the maximum of ij if those both are true. You're guaranteeing That the intervals overlap If they're not then you can possibly have the intervals not overlapping or I mean you do have it not overlapping So you must have this min max evaluated in this way For there to be guaranteed intersection And lucky for us this equates to evaluating these two determinants So Computing these ones in the way I said before if these are both less than or equal to zero you have intersection So basically with a very little number of operations we can determine If triangles intersect Especially on average when you consider the fact that we're throwing away almost all of the Possible intersection cases in the first phase of the algorithm and then even more in the second phase of the algorithm You know it's a very efficient on average for us to evaluate whether or not Faces intersect because if you can imagine we have you may have a model with thousands and thousands and thousands or even millions of triangular faces You want to have this be very efficient in terms of number of operations Now here's one more thing If you evaluate these two more determinants you can classify the intersection interval even further So basically the point is You want people to evaluate what is the sequence of i j l and k?  I made a mistake. Hold on. I'll fix that No, I didn't am I crazy? No, I didn't I'm just dyslexic. Nevermind. It's fine. So Basically if uh, you have these combinations of y 10 and y 9 you can get the actual sequence of the Points of intersection along line l now. Why does that matter that matters because On both triangles the actual intersection slice Sort of if I go back to the very top this This slice here Will always occur on both triangles between the center of those two vertices Uh, so these two vertices here in the middle. So in this case, it would be i j in this case It would be k j in this case. It would be k l in this case. It would be i l So basically if you can figure out what i and j are You can figure out exactly where the intersection occurs If y 10 and 9 are both, you know, in this in this condition here That's the plan of attack for the actual Quantification of where these lines of intersection between triangles occur We'll leave that for a second now. We'll go on to the actual calculations now So if you want to calculate the points of intersections Of you know on line l the first step is obviously defines line l Of player intersection. So if you have you know triangle t2 and t1 with their own normals And then you have plane p2 and p1 there They intersect along line l so line l has this form It is uh p0, which is you know at some point on this line Plus n1 cross n2 that's the direction times parameter t So what is p0? That's actually not very easy to find And in fact, this you'll see this is very complicated But basically you obviously have equations for plane one and plane two Because you have the normals and you have plenty of vertices on each face, right? You have Three vertices for each triangle so you can take your pick for p1 and p2 And this just gives you the equation for the plane Obviously n1 x and one y and one z are the Normalized that's very important. You have to have normalized values for this These are the Coordinates for the normal in uh for plane one and for n2 that's for plane two Now the third plane equation is basically arbitrary We're defining a plane passing through Any vertex that we know about it can be on triangle one it can be on triangle two It doesn't really matter, but just some point that we know And then uh it has the The l direction as it's normal So basically, uh, it's this plane equation here. So you have the x y and z components again, it should be normalized And you're taking any point anywhere on any of the triangles as to the point you're passing through With those you can make a very simple system of equations and honestly you can just solve this with an inversion But remember we're doing things efficiently because we want to be able to evaluate things that these things Very quickly for many many thousands of of canada intersections Um Once we have no down selected them to our to which ones are intersections We have to evaluate all of them as quickly as possible. So you don't want to be able you don't have to invert matrices If you don't have to that's a very intensive operation So there's actually a clever way to solve this But basically if you solve this system of equations You will solve x y and z for p zero and remember p zero is a point that we need in order to quantify line l So we this is the trick you can recall that row one And row three are perpendicular because remember n three is is the cross product of n one and n two So you know for a fact that m three is perpendicular to both n one and n two And so basically if we can just make rows one and two orthogonal Like rows one and three and two and three are The equation is already solved because once you have an orthogonal matrix or I guess in our case in An orthonormal matrix or whatever you call it The the solution just falls out remember because when you have an orthonormal matrix The transpose is the inverse and then you can evaluate this entire expression as simply A matrix multiplication right three by three matrix by three more matrix that will give you x y and z So if we can basically pull out the n two component from Uh this first row We've basically solved the problem. So that row operation is basically shown here. So you're taking row one subtracting out the n one dot n two so the n two component in the direction of n one Of row two and storing that in row one.  It's very important to renormalize because you have to have an orthonormal matrix For the transpose to be the inverse. I believe And so you have something like this when two deals operations, you'll have a same row two and row three as before But your row one will be very different E has this form just the magnitude For normalization, but here is very interesting that you don't have to actually evaluate the square root because When we solve the equation later on you'll have e times e So the square root will cancel out But that's sort of not either here or there You'll also have this revised right-hand side vector d So you have the same row two and three, but you have a different row one And so your original matrix looks like this So but but now with your orthonormal matrix a you can take the transpose and pre multiply Uh both sides and then you can evaluate p zero very simply like this So at transpose times d that will exactly give you p zero and once you have p zero you can fully define line l So basically now you have a closed form expression For a point on line l and with that you have line l and that's one of the hardest parts of solving the intersection problem And you did it with a single matrix inversion, which is very very nice Now step two once you have line l quantified like we do You want to find the intersection Of t one and t two online l. That's the intervals here i j and and k l. So you're basically evaluating four things But really only two like I said before because you only care about the center two of these uh Evaluation so here you care about k and l So you want you want of these four two of them So i is the intersection of a one b one with l And so on So to solve for i again, it's very simple. So we have a couple things so You have to have the equation of a one b one so you can parametrize this vector equation like this. So This is the a one Uh sort of coordinates and x y and z and this is the vector from a one to b one times parameter t And this is the the equation we have for line l. So we have p zero we have n three and u is the parameter So at the intersection obviously l Equals a one b one those two equal each other And so you can solve this equation You have three equations because you have three components x y and z and you have two unknowns t and u So it's an over defined or whatever they call it Uh system And so there's different ways you can solve it you have you know three different combinations of Um substitutions to solve this this system, right? And so you can go about that At the end of the day here is one possible case if you took the x and y equations and and solve the two of them you'd have this expression for t From the x and y coordinates. It looks like this. However Whenever you see a denominator In any sort of mathematical expression that you're using on a computer you should always question When will this be zero because this will be zero? You know quite frequently if you have um you know Uh primitives that are oriented along, you know x y and z axes because if a one b one is parallel with c This evaluates to zero, right? And also in some combinations of n three and a one b one You'll also have this to be zero, but you can't account for those before hand those are going to be flukes, right? So basically what you do is You can calculate not only t from x and y Equations but you can also calculate t from the x and z equations And the z and y equations and then what you do is you don't you don't solve the t values You you calculate the not dominant d You calculate the denominator values first. Sorry. So basically You pick whichever val whichever t so t x y t x or t z y you pick whichever t has the greatest value of the denominator If you do that or sorry, I should say denominator magnitude If you pick the t equation with the greatest denominator magnitude You will guarantee yourself that you're not going to have a zero in the denominator because zero is not a very high magnitude And also you'll have a very good computational Accuracy because you want to have a large denominator when you do when you do divisions because that just gives you more accurate results You know in in general So you'll you'll pick you'll force it like with the denominators here. So Uh denominator x y denominator x z denominator z y and c which is largest And then whichever is largest you'll evaluate the numerator and evaluate the total expression for t And once you have t you're basically done because once you have t you can solve for point i at x y and z from the original equation that we had here, right? And once you have i You know, you can calculate l k and j in the same way and then you can precisely describe where the intersection occurs So you repeat that process for j k and l as you need Remember, you only need in the middle two of those uh those points And at that point you can precisely quantify the region of intersection for any Non-coplanar triangles end of story Now, how do you detect overlapping?  I really hate it So basically the first thing you do as before is you check if the bounding boxes overlaps very simple if they do you go on Now here's the process the first thing you do is you test if any of triangle one's edges Cross any of triangle two's edges And there might be better ways to do this, but this is a very simple one to understand And I think it's it's pretty quick. I'm not sure if a fashion one exists I think possibly Olivier and fleet have a better one, but it's just too hard for me to explain in a video like this So but this this is comparable, you know very very closely comparable So you test if any edges cross then if no edges cross You test if a single point in t2 lies in t1. Why do you do that? Well, here's the reason why So let's say t1 is like this And t2 is like this Well, then no edges intersected, but still They overlap why because one of these vertices is inside this triangle So you test both if any of vertices in t1 are in t2 and vice versa If any of those things evaluate to true You have some kind of intersection Between the triangles In the plane So here's a here's a very simple way to calculate whether or not line segments intersect and this is very very clever So basically the way you do this is let me change my color really quick Take you have to set if I these two sort of dot products of cross products So let me explain how they work. So let's look at a1 b1 cross b1 b2 So a1 b1 b1 b2 is basically saying this This sort of curl If so basically the if you were to have the right hand rule So you put your right hand on the screen if a1 b1 b2 that points out of the page, right? And then it checks a1 b1 a2 So this Right hand rule that points into the page. So basically if Out of the page times in the page That will give you less than zero right because it would be you know If you dot them you'll have a negative number right because they're in opposite directions So if that's the case for both this this direction and this direction You are guaranteed to have intersection You basically want to you basically asking yourself does a2 b2 cross over a1 b1 in the sense that Sort of right hand rule would indicate that for both a1 b1 and a2 b2 But here's an example of that not being the case. So as before This And this are opposite directions of right hand rule curl however This hold them change colors this and this Are the same direction of right hand curl. So this lower expression Evaluates to false and then you do not have intersections of these line segments So basically this is a very efficient way to evaluate whether or not line segment intersect and you will repeat this for three times three Possibilities for any of t1 edges crossing triangle t2 right And then if if any of them do you can immediately stop Calculating you can say yes, we have intersection. The classification is done. We do have intersection Now the last two things there was checking if triangle t1's nodes are in triangle t2 boundaries and vice versa And like before we can evaluate this type of expression here you have a normal for triangle t1 you can take That cross it with the sides to evaluate the side normals and one and two and three as shown here And then you can calculate the dot product of the sides with these normals Sorry, I should say not the sides, but the The the vectors from the vertices to the point of interest like this this and this If those dotted with the normals are all the same sign Then the point is inside triangle t1 If any of them are different signs, it's not And I should say if if you have some zeros in there It may be fine depending on how you want to count intersections or not Because if you have two of the same sign and one zero that means that triangle a2 would be on an edge Like like here for example, and if you had two zeros That would mean that you're on a vertex like c1 there Now you may look at this and see difference from previous videos So in previous videos, I actually had six equations to evaluate That was just so I could make things very simple for you to understand when we have to do things efficiently I don't want to do any extreme calculations. So I'm only going to take three Three dot products here to evaluate whether or not we're inside the triangle or not Now how can you now once we have classified intersections of of co-planet triangles the question is how can you calculate the vertices Of that overlap zone. So here are two planar triangles And you have an overlap zone here between i j and a2 So these overlap zones are defined by A series of points right here the points are i j and a2, but these points are basically generated by any time A line segment on triangle t2 crosses a line segment on triangle t1 and any time you have a point inside Anytime you have a node from one triangle inside the other If you take all those points that entire point set that defines this boundary zone here So it's very simple It's it's actually very simple to understand but it's kind of hard to implement You're just going to basically be computing making a huge list of All the points on this sort of Overlap polygon and you'll get like I said before points from Intersections of line segments and then points from contained nodes like a2 here So again, um i and j are computed as the intersection of line segments. So here is an example for i and This should be deja vu because we did this just a few minutes ago. You have an equation for a line I guess p2 here and the equation for line p1 here So you it starts at a2 and it goes in this direction times parameter t and times parameter u And where p2 equals p1 you have intersection at point i uh, so basically, um We have a similar sort of the um t value as before We're going to be have three candidate t's so we have t x y t x z and t y x and again You want to write the denominator first and see whichever denominator has the maximum magnitude And use that denominator and that numerator for calculation of t And once you have t you can compute the point of intersection very easily And I should say by the way when you have an expression like this For you know anything If the t value is less than zero or greater than one The point of intersection of this line is not on the boundary that you said Because this is normalized so that zero basically means a2 and one means b2 So if you have any point that's less than zero or more than one You will not be on sort of the line segment part of this line And so at this point you're pretty much an expert in intersections of triangles And that's the that's the entire master class on intersections, but there's one last thing That we have to talk about because If you recall we have this point set here i j and a2 and when you have only three it's not a problem But when you have four five six, how do you know that these Points are in the correct order because the order Matters when you're talking about the polygon, right? And so basically I want to compute the vertex order for convex polygons So once you find the vertices of the polygonal overlap zone for these coplanar triangles You have to put them in a sequence. So here you have, you know, four points of interest They would be in like a rhombus shape here. You have, you know, two triangles making a Triangle shape here. You have two more in a triangle shape here. You have, you know, uh A hexagon shape And so there's different options and how do you know that these six vertices go in a certain order? You have to compute that right you can't just guess Now there are there are ways to Apply the previous sort of um intersection tests that you get these in this order Automatically, but they're honestly way too hard and then we can do this sort of ourselves in a very simple way So basically if that overlap zone has more than three vertices You have to define a sequence for them because like I said before there's a difference between here. You can see this Rhombus shape a b c d This rhombus shape a c d b has the same vertices just in a different order These three are sort of rotated around It gives you a you know to generate Part of lateral. It's not even a real shape, you know, it's it's self-intersecting. So it doesn't work It's it's also inaccurate because your region intersection was like this, right? So having these intersections is just just blatantly inaccurate. So when it comes down to quads, it's actually not that hard There's a sort of um method you can use so basically you have to ask Did the diagonals intersect so does the first and third vertex or sorry? There's the first and third Vertex combined into a diagonal cross over the second and fourth if it does You're fine. Your ordering is fine if the first and the third so a to d and b to c second to fourth if they Don't cross the signs don't don't cross Then what you have to do is you have to swap the first and the The fourth vertices here you'll swap a one and b one and then you can you can imagine swapping these two Would basically reduce you to this, right? So that's the process for quadrilaterals unfortunately for pentagons and hexagons you have to sort their points by the 3d angle about a normal vector at the center of that polygon That's the simplest way to understand how this works.  So you want people to evaluate all those things And so the process here is taking the arc tangent to that's a special kind of arc tangent Of this determinant and a dot product so It defined vectors v1 and v2 as sort of this vector and this vector And n as the unit normal very important has to be a unit normal Out of the plane here. So that's defined like n The dot product is simply v1 dot v2 and the determinant is n dot v1 cross v2 If you have these two you can evaluate this angle For these you know all of the possible angles so you can compute the angle here You get the angle here put the angle here put the angle here every single angle you can compute Of course obviously the angle from a center to a will be zero But all the rest are going to be in general, you know not known And then all you have to do is sort them in an ascending order If you sort these angles in ascending order and the points that go along with it in ascending order Then you're guaranteed to have a right-handed. I guess counterclockwise sequence of your polygon vertices This is this is big stuff. I mean, this is not easily understood not easily graspable You you have to be able to do this to be able to to orient your vertex set in a way that gives you Convex polygon that you can use for Other things that you may want to use for your your algorithm going forward. So we're going to use this stuff for Computational solid geometry We're going to triangulate this this polygon in other ways It's very important for us to know exactly what this polygon looks like for the next one or two videos in this series So that's very very important and that wraps up all the theory that goes into 3d triangle intersections So that's been 41 minutes. I'm gonna take a break and then I go through the code. I'll see you in a second Okay, welcome back so the First thing we have to do for our algorithm is add a couple things to our structures here So for um in order to basically encode this bounding box So I won't be able to encode the minimum and maximum x y and c values for everything. So I put here. Let me zoom in a little bit This is our structures for our you know geometry stuff For the edges for the faces and for the bodies I put these floats here These quantify the minimum maximum values for the bounding box around the the objects And of course we had to change the constructors for these things Which I did in order to put these things in place, but it's very simple. I'm not going to go into that The next thing here is these uh, let me go to the um actual geometry That c file and so I'll explain every algorithm that I implemented here in in order because it's kind of a Easiest to do that way so Let's talk about this first So these are two very short functions. One is one says rotate face nodes.  Well? This is why if you recall when we tried to determine if the Interaction intervals overlapped We basically said that we had to have a one be the lone vertex on its side of t2 And a vice versa a two being on its own side of t1 To do that you have to be able to to circularly rotate a b c on both triangles So this simply does that and then swapping Swapping basically guarantees that you are keeping your vertex on the same What's it called? Like a the positive subspace? Of the others of of the other plane So basically whenever you have rotation and you change the the Whenever you want to swap the face nodes to preserve your orientation of your face you can use this function here So next we have this function here edge edge intersection this basically determines if Two line segments a 1 b 1 and a 2 b 2 cross and we use this a couple times if you remember Where where where Where where where here? Yeah And also we used it down down here So basically this this determines if they intersect and also it gives you where they intersect So it will tell you this intersection point i here in terms of an output coordinate And it just implements what I just told you about here this tij. So basically it computes these cross products here Uh and dot drop part of them together that that's what I said before that's um this If those are satisfied it basically goes on and it computes the denominators It picks the largest denominator Evaluates the corresponding t value and with that corresponding t value. Um, we can compute the i value here I'm going to return it very simple the next the next function we have is edge line intersection This is a very similar it just evaluates where a 1 b 1 crosses a line a given line Through p zero interaction and three we use that um to compute this Basically where where a 1 b 1 crosses l And it's the same exact thing pretty much just a slightly different expression for t And again we divide with the denominators pick the largest denominator magnitude evaluate t make sure it's between zero and one If it's not it doesn't intersect if it does we evaluate where it does and we return one Very simple now Next is a function called coplanar node within triangle. This evaluates Are you know tried and true method of determining if triangle Node is another triangle In this way we've done a thousand times before I'm going to go over it again. Um Then This is the talk the part I talked about at the very end It's function called reorder points. This basically implements what I mentioned down here So what it does is it uh For the special case of a quadrilateral it does what I said it evaluates if the diagonals are crossing In in this way you can take a look in the code and if you'd like I would cross products takes the dot products of them and evaluates if they're uh If they're both less than zero if yes They cross and it's a good order. If not, we change them around Now for pentagons and hexagons, it's much more difficult and much more operations involved So we're doing this first thing we do is we evaluate the center point of all the points in our point set abc dne You calculate that like this, of course, we have a division divisions are not very good But you have to do what you have to do sometimes Um Now we're taking the normal We use that normal and the uh points a And center here took it with the angles as I mentioned down here And the function for that is in our trigonometry dot c file here So I these are we had we had this one before get node angle I added get point angle because it doesn't involve nodes it involves just generic points in space Uh, but it's pretty much the same operation here This is how we calculate the angle in 3d space This is the best way to do so keep you know keep this in the back of your mind for everything in your life This is extremely important equation Now once we calculate, um Uh that that angle we basically do an insertion insertion sort By that angle and we use the insertion sort algorithm to rearrange not just the angle list But also the point list In ascending order as I mentioned you can look up at insertion short. I'm not going to talk about that It's not in the scope of this discussion now Here are sort of the the the big um the big function. So I have one function that basically does This and one function that does this based off of this So this is called, uh, classified triangle intersect This takes in simply two faces Triangular faces and it will return these values return negative one if some kind of error return zero if they don't don't cross That's this it will return one if they intersect in a line Um in this form so this sequence of k i j and l returns two in this form three in this form four in this form And it returns five if they're coplanar very simple And the way it does that Well, uh, first things first I set a tolerance. Remember we have to use a tolerance not in zero because you know Things may not be exactly zero when you do floating point arithmetic So you have to use some small number. It could be smaller than this. That's probably too large of a tolerance, but whatever If we have more than three nodes per triangle we say that's bogus Now the first thing For our algorithm is we check if the bounding boxes overlap. So evaluating if the minimum values exceed the maximum values If they do Then there's no overlap No intersection if any of them do and I think I'm not sure what the compiler does I'm pretty sure if you wanted to you could break this up into like six different operations and You know, maybe save some operations here, but I'm pretty sure if you do an optimizing Um step for your compiler. I I I think it will just automatically do that. It will automatically break out if one of these is uh satisfied The next step is we're evaluating Let me scroll down a little bit. So we did we did phase phase a phase b. We're evaluating y one two and three That computes whether or not triangle t diversities are all above below or in the same plane or crossing the plane of triangle t one Um, if they're all the same sign No intersection is possible if they're all within the tolerance Uh, then you have a coplanar Case I'll come back to this in a second Um, and then if it's four five and six You can check those as well. If they're all positive you have an intersection If they're all zero, which I commented out because you don't need Um, you have a coplanar solution Uh, then what we do is we We rotate like I said before we rotate around these vertices a one b one c one and a two b two c two to make sure that Only the zero's node is on that side of the other triangle's plane Very simple. Then we evaluate some determinants here. Um To do that finally we Talk about um y seven y eight Nine and ten these are used so y seven eight are used to compute If we have an intersection at all So if we have an overlap of our interval intersection if the both less than zero We do and then we can check nine and ten And if they're different sort of combinations, we have different return values one two three and four again They correspond with different sequences of Um those points k i j and l On the interval of line, uh l here So i'm going back up now if it was coplanar Here if it's coplanar We Do some of the announcements we talked about down here Where is it? Here so we we first um We loop over all edges of face one to see if any of them cross face two edges If they if any of them cross we have intersections. So we return five, which means coplanar Then we check if any if a single node in this case node zero on face one is inside face two If it is we return five for coplanar Then we check vice the opposite if a single node of face two is inside inside triangle face one If yes return five if not they're coplanar, but they don't intersect Which is the best case for coplanar triangles um So that's that wraps up the classification step. So now we've basically evaluated how the triangles cross if they do They either don't cross they cross in One of four ways of a line segment or they cross in some kind of polygon Yeah At this point I have a final function here, which is triangle intersection points This computes the points of intersection. So for this it would compute this point and this point For this case it would compute this point this point and this point right It would compute all the points required for intersection of of the two triangles So the first thing is is it it calculates the mode remember it calculates the classification. So it runs this first between face one and face two if the mode is Not zero because if it's zero there's no intersection if it's between zero and five And you have a line segment like this. Oops like this I should say like this Oops, I hope it did break anyone. I hate that. Okay so uh Basically if we have a line segment intersection we can compute how it intersects. So in that case we're basically doing um This so the first thing we do is we compute um Everything we do is to basically compute these plane these planes because you want to be able to evaluate this expression here A transpose times d. So we basically do that. It's not really that hard Um after that we have we have basically solved for p zero That's I call it p three in the code. Um And then we'd look at the four different modes. So the modes being um Where is it? Yeah, these these four modes here one two one two three four whatever order it happens to be Based on whatever mode we have so intersection sort of sequence. We compute the two middle Uh points.  So modes one through four if mode is five Um here it says I should say equal equal five not So basically if they're co-planers And they intersect We have to do what we talked about down here Where here so we have to compute all these vertices. So the first thing we do is we Check we loop through all the edges in uh in I guess triangle one here We check if the we first check if the p th node of t one is inside t two and the p th node of t two is inside t one typo Let me fix that before I forget And then we check if the p th edge Crosses the q th edge of t two. So we loop through both t one and t two edges and see if any of them cross If they do we add them to a list of intersection points here And we increment the number of points in our list And then lastly if number of points exceeds three that is if we have You know something like this Like like this case or this case Then we must make sure that this sequence is a You know a convex not self intersecting polygon And for that we have the function reorder points talked about before That does the you know whole insertion short thing with the with the angles Um, and then it prints it out So if I uh if I compile that and I run it. Oh, sorry. Let me show you the the main thing first.  I'll I'll show you that in a second, but there's four triangles With different coordinates and I made them so they intersect in different ways Just to test out different parts of this code So what I do is I first I classify them just to see what the classification returns And then if it returns a number that's not zero. So if it returns intersection Then it computes the points of intersection and it will print them to the screen So very simple. So if I can recompile it rerun it We have these results. So Don't worry about them. Um, basically this just shows you that the the functions Work as intended. I will show you a graphic about how this looks right now. So Um, it's not going to be in the code, but it's in octave. So I made another function here. Um In uh, just in terms of octave or matlab code here with all those points So these are the four triangles one two three and four. These are where our code calculates. They intersect And then just plot some figures and it waits for us to hit enter between the two So let me show you how this looks so octave Let me send this to the other screen first So here is the first two triangles. So these two are not coplanar. These are just in just general intersection So the blue triangle is t1 red triangle is t2 and the yellow line there is the intersection interval You can see that it crosses exactly between the two So this test case works Hit enter. Second test case is right here. These are two coplanar triangles crossing in this way And you can see the red triangle blue triangle and the yellow triangle yellow triangle is the intersection of red triangle and the blue triangle Right that seems to work next Here's that star david thing. So there's two triangles here crossing in a hexagon plate a hexagon sort of uh sequence And again this test two thing a test can be compute the intersection points But it also tests If we can, you know, reorder them in a way that puts them in a uh, you know, clockwise right hand rule Sequence and it does so the red triangle, you know Crossing over the blue triangle gives us this yellow hexagon and everything seems to work just fine So That's it. I hope you really enjoyed this video. I hope that one or two people learned something It was a very long video. It's almost an hour now so If you did that's awesome. If you didn't that's awesome too. Either way. Have a great day


Hi, I am Annalena Caputo and I'm a research fellow in the ADAP Center in Trinity College Dublin. I work on personalization and user modeling and the idea is to build a user model that has the computer, what are your preferences, what are your interests in a way that then you can access information in a easier way. I use distributional semantics model that our model of representing meanings has a dramatical space. So in these models points represent words and similar words are represented by nearby points. At predict today I told about how to make sense of our past by looking at large corpora that span multiple periods of time and using quantitative analysis to extract information out of it.