Individual Software Engineering Project

project content
This work belongs to the Northern software engineering courses Spring 2020 Computer Software Engineering Institute (Roger Ren Jianxin)
The requirements of this job, please click on the link to view 2020BUAA software engineering individual project work
Teaching classes 005
Github project address https://github.com/syncline0605/IntersectProject
My aim in this course The ability to improve their code, the learning process of the development of teamwork
This job helped me achieve the goals of specific aspects PSP practice course, be familiar with the process developed in C ++ with VS, VS familiar with the various tools

PSP table

Before we start implementing the program, in the following form to record your PSP is estimated to be spent on the development of the various modules of the program time

PSP2.1 Personal Software Process Stages Estimated time consuming (minutes) The actual time-consuming (minutes)
Planning plan
- Estimate - How much time is estimated that the task requires
Development Develop 660 930
- Analysis - needs analysis (including learning new technologies) 180 240
- Design Spec - Generate design documents 30 30
- Design Review - Design review (and colleagues reviewed the design documents) 30 0
- Coding Standard - code specification (to develop an appropriate specification for the current development) 60 0
- Design - specific design 60 60
- Coding - specific coding 120 420
- Code Review - Code Review 60 0
- Test - test (self-test, modify the code, submit modifications) 120 180
Reporting report 180 210
- Test Report - testing report 120 120
- Size Measurement - computational effort 30 30
- Postmortem & Process Improvement Plan - hindsight, and propose process improvement plan 30 60
total 840

Pre-design phase of a more relaxed time, we can continue to modify the design, a new query method, and while the design work while writing blog. After the overthrow of a version of the design and deleted the blog has been written, so I spent a lot of time. In the coding stage, because it is not familiar with the C ++ language, deal with syntax of C ++ error cost a great time, sometimes a few hours looking for an otherwise very simple little errors, but generally speaking, because the pre've worked out the code structure, other than syntax errors is not much hindrance. In the analysis, the testing phase, the remaining time is quite inadequate because there is no time to fully complete the PSP process, failed to make the code style analysis, operational analysis and unit testing.

Generally speaking, in this personal project, I deeply understand that the "design first encoded" superiority; but on the one hand due to the long time with pre-designed, mid language not familiar with coding errors too much, resulting in lack of stamina , anticlimactic, did not complete the work required in the later stages of analysis and testing, the program does not completely eliminate the warning. By the time the job I will continue to carefully complete this section.

Description of problem-solving ideas

Needs analysis (including learning new technologies)

1, after reading the personal project work, first of all for the scoring rules, plans to study the following new technologies:

2, the input program is a command line parameter, you need to design and write a function to parse the command line arguments

  • Because the program must have an input (-i) and an output (-o), this may be based on a simplified procedure

3, for the Line and the intersection of the straight line, straight line programming solution to the problem intersection circle, circle and circle intersection, after learning decided to apply the following methods:

  • The general idea: first determines whether there is an intersection, the intersection if the intersection coordinates recalculation; many intermediate thus calculated data is not repeatedly calculated and the calculation function to determine not separate writing,

  • Point on a straight line projection

    • Line from \ (P_1 \) points \ (P_2 \) unit vector is e, two points on a straight line \ (P_1, P_2 \) , points to be solved \ (P \) , the projection point \ (P_r \)
    • Determines the vector \ (<P_1, P> \ ) projection vector in the direction e \ (<P_1, P_r> \) , binding \ (P_1 \) coordinates, \ (P_r \) coordinates will easily seek Out
  • Straight lines and line intersection

    • When two identical or two slope of the line do not exist when the slope of the line, the intersection of two straight line without

    • If a straight line through two points \ (P_1, P_2 \) , then to be expressed as \ (Ax + By + C = 0 \) in the form of

    • \(A = P_1.y - P_2.y , B = P_2.x - P_1.x , C = P_1.x * P_2.y - P_2.x * P_1.y\)

    • If two intersecting straight lines \ (A_0x + B_0y + C_0 = 0 \) and \ (+ B_1y A_1x C_l = 0 + \) , their intersection is \ ((X, Y) \ )

      \(X = (B_0*C_1 - B_1*C_0)/D\)

      \(Y = (A_1*C_0 - A_0*C_1)/D\)

      \ (D = (B_1 A_0 * - * B_0 A_1) \) (D is 0 if two straight lines parallel)

  • Linear and circular intersection

    • First seek center \ (P \) projected point on a straight line \ (PR \) coordinates, then we can find the Vector <p, pr>die length \ (m \) , this module length \ (m \) radius \ (R & lt \) Compare
    • If \ (m \) larger than the radius \ (R & lt \) , no intersection
    • If \ (m \) equal to the radius \ (R & lt \) , there is a point of intersection, the projected point \ (PR \) is the intersection point
    • If \ (m \) smaller than the radius \ (R & lt \) , there are two points of intersection, the first using the Pythagorean theorem, according to \ (m \) and (R & lt \) \ half circle length of the line segment is determined; and then based on this direction vector length of the line, the coordinates of projection point and a straight line to obtain the coordinates of two points of intersection of
  • Round and round intersection

    • See the following blog
  • Reference Learning blog:

Design and implementation process

Design data storage mode

  • struct Point(struct Vector)
    • When calculated in a coordinate system, Vector is a very important concept. From the data, it is the same point with a horizontal axis double x, a vertical axis double ycan be expressed, but it should also be save die lengthdouble length
  • struct Line

  • struct Circle

  • By STL vectorsaving each data structure entries
    • vector< Line >
    • vector< Circle >
  • By STL setsaving data structure at each intersection, the intersection will not be repeated to ensure that the stored
    • set< Point >

Design Function

  • Command line parsing function
  • Input handler
  • Seeking a vector connecting the two points
    • Input: Point A,Point B
    • Output:Vector M
  • Seeking a point on a line projected coordinate function
    • Input:Point A ,Line l
    • Output:point M
  • Seeking straight line distance between the point function
    • Input:Point A ,Line l
    • Output:int distance
  • Function evaluation function of the number of intersections of two straight lines / cross the Line circle points / demand function the number of intersections of two circles
    • Output: the number of intersections
    • Intersection coordinate obtained by reference to a function as a parameter

Unit test design

  • Not a complete unit test all functions, mainly using test cases based simply on some small function unit tested

Test case design

Program Performance

Using a randomly generated test set contains more than a thousand pieces of data, a minute run (i.e., terminate before run).

Obviously, the program will use most of the time in the set of elements inserted on

In addition, based on the exact value determined rewriting equals significance also take up a lot of time

I thought about such an optimal way in the design phase, but in the end did not have time to realize

  • Whenever the calculated two straight \ (l_1, l_2 \) an intersection or linear (L \) \ circle \ (C \) after intersection, the intersection can be determined
    • Has not been determined whether the remaining (L_1 \) \ the intersection, and \ (L_2 \) on a straight line intersection, if the can be recorded do not have to be calculated and determined (because there can be only two straight lines a intersection)
    • Has not been determined whether the remaining (L \) \ on the straight line intersection, supra

Code Description

  • Find the intersection of two straight lines

  • Find the intersection of the line with the circle

Guess you like

Origin www.cnblogs.com/syncline/p/12457802.html