Citation of 3rd Party Code

It is common practice in programming to use code from other sources / books. However as all of our code is used for academic purposes and assignments it is important that any code used from 3rd party sources are correctly referenced. It is assumed that you will be using the ngl:: graphics library and this code is already attributed to the various authors so it may be included without citation. Using code from other people on the course is also acceptable but the original author must be attributed. If the code already contains an Open Source license such as the GPL license *** this must not be removed *** but retained in the code submitted. For example :

/// This function was originally written by Jon Macey
void foo()
	std::cout<<"foo \n";
/// end of function

However other code either from Websites or books must be cited using the Harvard standard as outlined in the University guidelines. For example if the whole module came from a website and was modified put this at the top of the source file(s)

/// @brief a simple C++ example
/// Modified from :-
/// Bjarne Stroustrup (October 4, 2009). C Style and Technique FAQ [online].
/// [Accessed 2010]. Available from: "".

If you are using other 3rd Party code do not remove any comments / Author tags etc. Where possible, existing code should be maintained intact, in a seperate file (or better library), and accessed via the original authors API’s rather than being pasted into your own code. If this is not possible reference the original source and explain why you have modified it and where.

If only a small section of code is used you must indicate the start and the end of the section as follows

/// The following section is from :-
/// Dan Sunday (2006). Intersections of Rays, Segments, Planes and Triangles in 3D [online]. [Accessed 2010]. 
/// Available from: "".
ngl::Vec3 n=ngl::calcNormal(m_v0,m_v1,m_v2);
float a =;
float b =;
float r=a/b;
/// end of Citation

We use the /// end of Citation flag to indicate the end of the 3rd party code. If multiple sources are used you must cite them in the same way


The use of co-pilot is very common in programming, whilst it may give many suggestions I would not expect the inline suggestions to be cited. However if you use the chat element to ask for help or specific code structures / algorithms then this should be cited with the prompt used. For example.

// code modified from this example 
// prompt :- write c++ code to convolve an array of floats
// co-pilot suggested the following
std::vector<float> convolve(const std::vector<float>& a, const std::vector<float>& b) {
    std::vector<float> result(a.size() + b.size() - 1, 0.0f);
    for (int i = 0; i < a.size(); ++i) {
        for (int j = 0; j < b.size(); ++j) {
            result[i+j] += a[i] * b[j];
    return result;

After this put in the code you modified or used.