SlideShare a Scribd company logo
1 of 1
Download to read offline
IN PYTHON:
11.34 final project 1 : ellipses ... For this lab you will build a class that implements ellipses. We
define the distance between point (x,y) to the ellipse centered at point ( xc,yc) with x-axis length (a
) and y-axis length (b) as d2=a2(xxc)2+b2(yyc)2 Note that this is an axis aligned ellipse. The
ellipse also has a parameter theta that sets its rotation angle. Note that theta is a rotation around
the point (xc,yc) and not around the origin. Write a class called ellipse_2d that takes at
construction the values center =(xc,yc),ab=(a,b), theta. Use as default values center =(0,0),ab=(1,
1), theta =0. Your ellipse_2d class should implement the following: 1. A method called d(x,y) that
returns the distance from the ellipse to point (x,y). 2. A method called intPts ( d) that returns a list
of (x,y) pairs at all integer (x,y) locations within distance d of the ellipse. Note: an integer location
is e.g. (3,1) is an (x,y) pair that have no fractional component. 3. A property called theta that sets a
rotation angle on the ellipse. IMPORTANT: the rotation must be centered on the point (xc, yc)
NOT around the origin. HINTS 1. To rotate a point (x,y) around the origin by an angle theta, use
import numpy as np mxRotate =nparray([[npcos( theta ),1npsin( theta )],[npsin(theta),npcos(theta
)]]) (xRot,yRot)=npmatmul((x,y),mxRotate) 2. Before rotating a point, be sure to 'center' it on the
ellipse, x=xxcy=yyc This is because we want the ellipse to rotate about its own centroid, not about
the origin. After rotating, be sure to reverse the centering. 3. You may find it helpful to plot your
ellipse, use plt.plot(x,y,,r) to draw a red dot at every point (x,y). Also, adding a plt. gca () . axis
('equal') will show your plot with the proper aspect ratio between the X and Y axes spacing.

More Related Content

Similar to Python Ellipse Class

Journey to structure from motion
Journey to structure from motionJourney to structure from motion
Journey to structure from motionJa-Keoung Koo
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerJanie Clayton
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developingAbbyWhyte974
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developingMartineMccracken314
 
DETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECTDETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECTAM Publications
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 
Module 2 lesson 4 notes
Module 2 lesson 4 notesModule 2 lesson 4 notes
Module 2 lesson 4 notestoni dimella
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformationsshanthishyam
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingFayan TAO
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
Numerical Analysis Assignment Help
Numerical Analysis Assignment HelpNumerical Analysis Assignment Help
Numerical Analysis Assignment HelpMath Homework Solver
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2SIMONTHOMAS S
 

Similar to Python Ellipse Class (20)

Journey to structure from motion
Journey to structure from motionJourney to structure from motion
Journey to structure from motion
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing
 
DETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECTDETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECT
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Module 2 lesson 4 notes
Module 2 lesson 4 notesModule 2 lesson 4 notes
Module 2 lesson 4 notes
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformations
 
SSA slides
SSA slidesSSA slides
SSA slides
 
2d transformation
2d transformation2d transformation
2d transformation
 
Statistical Physics Assignment Help
Statistical Physics Assignment HelpStatistical Physics Assignment Help
Statistical Physics Assignment Help
 
06.Transformation.ppt
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume rendering
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
Parabola
ParabolaParabola
Parabola
 
Lecture_note2.pdf
Lecture_note2.pdfLecture_note2.pdf
Lecture_note2.pdf
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
Numerical Analysis Assignment Help
Numerical Analysis Assignment HelpNumerical Analysis Assignment Help
Numerical Analysis Assignment Help
 
Numerical Analysis Assignment Help
Numerical Analysis Assignment HelpNumerical Analysis Assignment Help
Numerical Analysis Assignment Help
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2
 

More from adithiyaatextile

In the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdfIn the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdfadithiyaatextile
 
In terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdfIn terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdfadithiyaatextile
 
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdfIn the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdfadithiyaatextile
 
In the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdfIn the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdfadithiyaatextile
 
In the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdfIn the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdfadithiyaatextile
 
In the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdfIn the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdfadithiyaatextile
 
In the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdfIn the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdfadithiyaatextile
 
In the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdfIn the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdfadithiyaatextile
 
In the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdfIn the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdfadithiyaatextile
 
In the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdfIn the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdfadithiyaatextile
 
In the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdfIn the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdfadithiyaatextile
 
In the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdfIn the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdfadithiyaatextile
 
In the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdfIn the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdfadithiyaatextile
 
In the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdfIn the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdfadithiyaatextile
 
In the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdfIn the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdfadithiyaatextile
 
In the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdfIn the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdfadithiyaatextile
 
In the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdfIn the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdfadithiyaatextile
 
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdfIn the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdfadithiyaatextile
 
In Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdfIn Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdfadithiyaatextile
 
In the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdfIn the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdfadithiyaatextile
 

More from adithiyaatextile (20)

In the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdfIn the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdf
 
In terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdfIn terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdf
 
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdfIn the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
 
In the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdfIn the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdf
 
In the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdfIn the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdf
 
In the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdfIn the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdf
 
In the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdfIn the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdf
 
In the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdfIn the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdf
 
In the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdfIn the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdf
 
In the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdfIn the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdf
 
In the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdfIn the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdf
 
In the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdfIn the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdf
 
In the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdfIn the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdf
 
In the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdfIn the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdf
 
In the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdfIn the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdf
 
In the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdfIn the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdf
 
In the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdfIn the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdf
 
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdfIn the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
 
In Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdfIn Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdf
 
In the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdfIn the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdf
 

Recently uploaded

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

Python Ellipse Class

  • 1. IN PYTHON: 11.34 final project 1 : ellipses ... For this lab you will build a class that implements ellipses. We define the distance between point (x,y) to the ellipse centered at point ( xc,yc) with x-axis length (a ) and y-axis length (b) as d2=a2(xxc)2+b2(yyc)2 Note that this is an axis aligned ellipse. The ellipse also has a parameter theta that sets its rotation angle. Note that theta is a rotation around the point (xc,yc) and not around the origin. Write a class called ellipse_2d that takes at construction the values center =(xc,yc),ab=(a,b), theta. Use as default values center =(0,0),ab=(1, 1), theta =0. Your ellipse_2d class should implement the following: 1. A method called d(x,y) that returns the distance from the ellipse to point (x,y). 2. A method called intPts ( d) that returns a list of (x,y) pairs at all integer (x,y) locations within distance d of the ellipse. Note: an integer location is e.g. (3,1) is an (x,y) pair that have no fractional component. 3. A property called theta that sets a rotation angle on the ellipse. IMPORTANT: the rotation must be centered on the point (xc, yc) NOT around the origin. HINTS 1. To rotate a point (x,y) around the origin by an angle theta, use import numpy as np mxRotate =nparray([[npcos( theta ),1npsin( theta )],[npsin(theta),npcos(theta )]]) (xRot,yRot)=npmatmul((x,y),mxRotate) 2. Before rotating a point, be sure to 'center' it on the ellipse, x=xxcy=yyc This is because we want the ellipse to rotate about its own centroid, not about the origin. After rotating, be sure to reverse the centering. 3. You may find it helpful to plot your ellipse, use plt.plot(x,y,,r) to draw a red dot at every point (x,y). Also, adding a plt. gca () . axis ('equal') will show your plot with the proper aspect ratio between the X and Y axes spacing.