is RayVsCircle is correct and optimal? : struct isect_s {
		isect_s() : type(isect_type_e::NONE), points(std::nullopt), depth(1.f), normal(0.f,-1.f) { t[0] = 0, t[1] = 1; } // in cases where hard to determine normal is point up
        template <typename OptInsPt = std::vector<vec2f>>
        isect_s(const isect_type_e& t, const vec2f& nor, const OptInsPt& pts = std::nullopt, real32_t dep = 1.f, real32_t t1 = 0.f, real32_t t2 = 1.f ) {
            t[0] = t1; t[1] = t2;
            normal = nor;
            depth = dep;
            points = pts;
            type = t;
        }

		real32_t t[2];      // intersect parameters for rays line segments/sweep trace of hull shapes/discriminants
        /*
		vec2f p[2];         // absolute intersect point or points
		uint8_t n_points;   // quantity of points 0 mean no collision so std::nullopt insted of isect_s, may be 1 for tangent case (touching edge/vertex) or nested in space, 2 for pt passed through like two rays, ray/circle or two AABB if not coincidence case
		bool bnested;       // true if one object totally inside other or they equal and coincidence so edges not overlaps or totally overlaps mean normal (unit dir) and depth (scale for normal) will be shortest dist to separate objects
        */

        isect_type_e type;
        std::optional<std::vector<vec2f>> points; // if points is nullopt then object nested only normal (unit dir) and depth scale for it should be used to separate objects
       
        vec2f normal;       // normal to hit surface if ray/seg inside circle normal will point inside to src so depth will be negative value?
		real32_t depth;     // penetration depth = 0 mean we just touching - tangent case, negative when shape inside other shape or equal 1 if src of ray or traced sweep hull shape is outside and passes through
	};

	bool IsPointOnRay(const vec2f& pt, const vec2f& origin, const vec2f& dir) {
		auto v = pt - origin;
		if (!is_zero(v.cross(dir)))
			return false;
		if (v.dot(dir) < 0.0f && !is_zero(v.len_sqr()))
			return false;
		return true;
	}

	// Check if a point is on a bounds of axis formed by line seg
    inline bool IsPointOnSeg(const vec2f& p, const vec2f& src, const vec2f& end) {
		// Check if point is within bounding box of seg
		if (std::min(src.x, end.x) <= p.x && p.x <= std::max(src.x, end.x) &&
			std::min(src.y, end.y) <= p.y && p.y <= std::max(src.y, end.y)) {
            auto dist = end - src;
			// Calculate the distance of the point from the line formed by the seg
            auto d = (p - src).cross(dist) / dist.length();
			// Check if the point is close enough to the seg
			if (is_zero(d))
				return true;
		} return false;
	}

    // shortest dist to infinite line (plane)
    inline auto DistToLine(const vec2f& point, const vec2f& origin, const vec2f& normal) {
		return normal.dot(point - origin);
	}

    // shortest dist to seg body or to it's endpoints
	inline auto DistToSegment(const vec2f& src, const vec2f& end, const vec2f& point) {
        /*
		auto seg = end - src;
		auto len_sqr = seg.len_sqr();
		if (is_zero(len_sqr))
			return point.dist_to(src);
		// t is projection point parameter to the axis formed by seg
		auto t = seg.dot(point - src) / len_sqr;
		vec2f closest_pt_on_seg;
		if (t < 0.0f)
			closest_pt_on_seg = src;
		else if (t > 1.0f)
			closest_pt_on_seg = end;
		else
			closest_pt_on_seg = src + seg * t;

		return point.dist_to(closest_pt_on_seg);
        */
		auto seg = end - src;
		auto pt2src = src - point;
		// Calculate the squared length of the line seg
		auto seglensqr = seg.dot(seg);
		// If the line seg has zero length, the distance is the distance to the source point
		if (is_zero(seglensqr))
			return pt2src.length();
		// Calculate the parameter value along the line seg (projection of point onto the line)
		auto t = pt2src.dot(seg) / seglensqr;
        // Calculate the distance between the input point and the closest point
        return point.dist_to(t < 0.f ? src : t > 1.f ? end : src + t * seg);
	}

    inline std::optional<isect_s> PointVsLine(const vec2f& pt, const vec2f& origin, const vec2f& normal) {
        auto d = DistToLine(pt, origin, normal);
        if (is_zero(d)) // depth mean 1 for unit normal
            return isect_s(isect_type_e::TANGENT, normal, std::vector<vec2f>{pt}, 1.f);
        if (d < 0.f)
            return isect_s(isect_type_e::NESTED, normal, std::nullopt, d);
        return std::nullopt;
    }

	inline real32_t DistToCircle(const vec2f& point, const vec2f& origin, real32_t radius) {
		return (point - origin).length() - radius;
	}

    inline std::optional<isect_s> RayVsCircle(const vec2f& origin, const vec2f& dir, const vec2f &center, real32_t radius, vec2f::value_t max_len = std::numeric_limits<vec2f::value_t>::max()) {
		// Translate the ray to the src of the circle
		vec2f local_origin = origin - center;

		auto a = dir.dot(dir);
		auto b = 2.f * local_origin.dot(dir);
		auto c = local_origin.dot(local_origin) - radius * radius;
		auto disc = b * b - 4.f * a * c;

		if (disc < 0.f)
			return std::nullopt;

		auto two_a = 1.f / (2.f * a);
		auto sq_disc = std::sqrt(disc);
		auto t1 = (-b + sq_disc) * two_a;
		auto t2 = (-b - sq_disc) * two_a;

		// t1 is guaranteed to be the smaller of the two roots
		if (t1 <= 0.f) {
			// Case 0: Ray origin is inside the circle
			if (t2 <= 0.f)
				return std::nullopt; // Ray is pointing away from the circle

			// Case 3c: Ray origin is inside the circle and not on the edge
			vec2f p2 = origin + dir * t2;
			return isect_s(isect_type_e::NESTED, (p2 - center).normalized(), std::vector<vec2f>{p2}, 1.f, t2, max_len);
		}
		
        if (t2 <= 0.f) { // Case 1: Ray is pointing away from the circle and not on the edge
			vec2f p1 = origin + dir * t1;
			return isect_s(isect_type_e::TANGENT, (p1 - center).normalized(), std::vector<vec2f>{p1}, 1.f, t1, max_len);
		}

		// At this point, t1 and t2 are both positive
		vec2f p1 = origin + dir * t1;

		if (t1 < max_len && t2 < max_len) { // Case 2: Ray intersects the circle and passes through it
			vec2f p2 = origin + dir * t2;
			return isect_s(isect_type_e::OVERLAPS, (p1 - center).normalized(), std::vector<vec2f>{p1, p2}, 1.f, t1, t2);
		}
		
        if (t1 < max_len) // Case 1: Ray is tangent to the circle and points towards it
			return isect_s(isect_type_e::TANGENT, (p1 - center).normalized(), std::vector<vec2f>{p1}, 1.f, t1, max_len);
		
        if (t2 < max_len) { // Case 1: Ray is tangent to the circle and points away from it
			vec2f p2 = origin + dir * t2;
			return isect_s(isect_type_e::TANGENT, (p2 - center).normalized(), std::vector<vec2f>{p2}, 1.f, t2, max_len);
		}

		// Ray misses the circle completely
        return std::nullopt;
	}