/**
* Author: Victor Lecomte, chilli
* Date: 2019-10-31
* License: CC0
* Source: https://vlecomte.github.io/cp-geo.pdf
* Description: Finds the external tangents of two circles, or internal if r2 is negated.
* Can return 0, 1, or 2 tangents -- 0 if one circle contains the other (or overlaps it, in the internal case, or if the circles are the same);
* 1 if the circles are tangent to each other (in which case .first = .second and the tangent line is perpendicular to the line between the centers).
* .first and .second give the tangency points at circle 1 and 2 respectively.
* To find the tangents of a circle with a point set r2 to 0.
* Status: tested
*/#pragma once
#include"src/geometry/Point.h"template<classP>vector<pair<P,P>>tangents(Pc1,doubler1,Pc2,doubler2){Pd=c2-c1;doubledr=r1-r2,d2=d.dist2(),h2=d2-dr*dr;if(d2==0||h2<0)return{};vector<pair<P,P>>out;for(doublesign:{-1,1}){Pv=(d*dr+d.perp()*sqrt(h2)*sign)/d2;out.push_back({c1+v*r1,c2+v*r2});}if(h2==0)out.pop_back();returnout;}
Traceback(mostrecentcalllast):File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/documentation/build.py",line71,in_render_source_code_statbundled_code=language.bundle(stat.path,basedir=basedir,options={'include_paths':[basedir]}).decode()~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus.py",line187,inbundlebundler.update(path)~~~~~~~~~~~~~~^^^^^^File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py",line312,inupdateraiseBundleErrorAt(path,i+1,"#pragma once found in a non-first line")onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt:src/geometry/CircleTangents.h:line13:#pragmaoncefoundinanon-firstline