示例#1
0
    public SymbolAnalyzerResult Analyze(List <Vector3> points)
    {
        List <SymbolComparationResult> comparationResults = symbolComparator.CompareCustomSymbolWithAllTemplates(points);
        SymbolComparationResult        bestResult         = GetBestResult(comparationResults);
        SymbolAnalyzerResult           resultOfAnalyze    = new SymbolAnalyzerResult(bestResult.Type, bestResult.Value);

        return(resultOfAnalyze);
    }
示例#2
0
    public static CustomSymbol CreateSymbol(List <Vector3> points)
    {
        List <Vector3> correctedCountPoints = CorrectPointsCount(points);
        Vector3        spellCenter          = SymbolsHelper.CalculateSymbolCenter(correctedCountPoints);

        Basis basisBasedOnPlayerSight       = CreateBasisBasedOnPlayerSight(spellCenter, Player.instance.headCollider.transform.position);
        Basis basisToProjectPointsToXyPlane = CreateBasisToProjectPointsToXyPlane(basisBasedOnPlayerSight);

        List <Vector3> poitnsProjectedToPlaneInPlayerSightBasis = MathHelper.ProjectPointsToPlane(correctedCountPoints, spellCenter, basisBasedOnPlayerSight.Forward);
        List <Vector3> pointsProjectedToXyPlane = ProjectPointsToXyPlane(poitnsProjectedToPlaneInPlayerSightBasis, spellCenter, basisToProjectPointsToXyPlane);
        List <Vector3> resizedPoints            = ResizeShapeToFitRecognitionSquare(pointsProjectedToXyPlane);

        SymbolAnalyzerResult result = SymbolAnalyzer.Instance.Analyze(resizedPoints);

        CustomSymbol newSymbol = new CustomSymbol();

        newSymbol.Type        = result.IsPassed() ? result.SymbolType : SymbolType.Unrecognized;
        newSymbol.Center      = spellCenter;
        newSymbol.Orientation = basisBasedOnPlayerSight;
        newSymbol.Size        = SymbolsHelper.GetWidthAndHeightOfShape(pointsProjectedToXyPlane).MaxDimension;

        return(newSymbol);
    }