What is return type T?

i’m just using ofPolyline’s method, getNormalAtIndexInterpolated.

but i can’t understand what its return type T means, that is noted on https://openframeworks.cc/documentation/graphics/ofPolyline/#show_getNormalAtIndexInterpolated

anyone can help me out please?

The variable T is often used in Templates.

By using templates one can create functions that work on different data types. For instance , a sum function that takes int, float, double, etc. The type (int, float, double) is represented by the variable T (type).

In the case of ofPolyline it might be to accept 2D points (glm::vec2) and 3D points (glm::vec3)?

The documentation you see online is in part automatically generated. The tool generating the docs is probably not smart enough atm to show us something more useful than “T”. But if I enter

ofPolyline line;

and I hover the mouse over getNormalAtIndexInterpolated the tooltip (in QtCreator) indicates that the return value is actually a glm::vec3

1 Like

thank you hamoid. helped me alot!

1 Like