\documentclass[french]{exam}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}
\usepackage[a4paper, headheight=127mm]{geometry}
\usepackage{xcolor}
\usepackage{microtype}
\usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{optics}
\usepackage{fp}
\usepackage{multido}
\usepackage{fontawesome5}
\usepackage[separate-uncertainty=true]{siunitx}
\sisetup{locale = FR,detect-all,}
\usepackage{booktabs}
\usepackage{cancel}
\usepackage{pifont}
\usepackage{subfigure}
\usepackage[most]{tcolorbox}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\usepackage{xcolor}
\usepackage{babel}
\frenchsetup{StandardLists=true}

\begin{document}

\begin{tikzpicture}[scale=.8, use optics]
	%paramètres modifiables ------------
	%taille de la lentille
	\pgfmathsetmacro{\tailleL}{2};
	%hauteur de l'objet
	\pgfmathsetmacro{\tailleob}{0.6};
	%position de l'objet
	\pgfmathsetmacro{\xA}{-1.7};
	%focale de la lentille
	\pgfmathsetmacro{\f}{2.5};
	%calculs -------------
	\pgfmathsetmacro{\xAA} {(\xA*\f)/(\xA+\f)};%position de l'image
	\pgfmathsetmacro{\tailleim}{(\xAA*\tailleob)/\xA};%hauteur de l'image
	%schéma ---------
	%lentille mince
	\coordinate (O) at (0,0);
	\coordinate (F') at (\f,0);
	\draw (O) node[below left] {O};
	\draw (\f,-2pt) --++ (0,4pt) node[above] {F'};
	\draw ({-\f},2pt) --++ (0,-4pt) node[below] {F};
	\draw[shift={(O)},ultra thick ,<->,>=latex]
	(0,-\tailleL)--(0,\tailleL) node[above]{ Lentille};
	%axe optique
	\draw[thin,->]({\xAA*1.2},0)--({-\xAA*1.2},0);
	%objet
	\coordinate (B) at (\xA,\tailleob);
	\draw [thick,->,>=latex](\xA,0)--++(0,{\tailleob}) node [above]{B};
	\node at (\xA,-0.3){A};
	%image
	\coordinate (A') at ({\xAA},0);
	\coordinate (B') at ({\xAA},{\tailleim});%position de l'image
	\draw [thick,->,>=latex](A')--++(0,{\tailleim}) node [below,left]{B'};
	\node[below=0.04cm] at ({\xAA},0){A'};
	%rayons-----------------
	%rayon passant par O
	\draw[blue,->>-] (B)--(O);
	\draw[blue,dashed] (O)--(B');
	\draw[blue, ->>-] (O)--({-\xAA},{-\tailleim});
	%rayon passant par F
	\draw[green!50!black,->>>-] (B)--(0,{\tailleim});
	\draw[green!50!black, dashed] (0,{\tailleim})--(B');
	\draw[green!50!black,->>>-] (0,{\tailleim})--({2*\f} ,{\tailleim});
	\draw[green!50!black,dashed] ({-\f},0)--(B);
	% rayon // axe optique
	\draw[red,->-] (B)--(0,{\tailleob});
	\draw[red,dashed] (0,{\tailleob})--(B');
	\draw[red, ->-] (0,{\tailleob})--({2*\f}, {-\tailleob});
	% rayon quelconque
	\draw[black!80!white, ->-] (B) -- (0,{-\tailleL /2});
	\draw[black!80!white, dashed] (0,{-\tailleL /2}) -- ({\xAA}, {\tailleim});
	%prolongement du rayon quelconque an
	\pgfmathsetmacro{\calcangle}{atan((-\xAA)/(\tailleim))}
	\draw[black!80!white, ->-] (0,{-\tailleL /2}) --++ ({\calcangle}:4);
\end{tikzpicture}

\end{document}