### Checking Point Containment on Flat Surface - CGA - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Provides an example of using the `SurfaceNearContainsPoint` method on a flat element (`f2`) to check if a given 3D point (1.2, 2.4, -1.2) is located near its surface. ```c# if (f2.SurfaceNearContainsPoint(1.2, 2,4, -1.2)) ... ``` -------------------------------- ### Getting Surface Points of a Flat - CGA - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Shows how to use the `GetSurfacePointVectors3D` method on a flat element (`f2`) to retrieve a collection of 3D vectors representing points that lie on the flat's surface. ```c# var surfacePoints = f2.GetSurfacePointVectors3D(); ``` -------------------------------- ### Creating a CGA Space - RGaConformalSpace - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Initializes a Conformal Geometric Algebra space with a specified dimension (5 in this case). This object is required to define geometric elements and perform CGA computations. ```c# // Create a 5-dimensional CGA space var cga = RGaConformalSpace.Create(5); ``` -------------------------------- ### Defining Direction Elements - CGA - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Demonstrates how to create weighted direction elements of different dimensions (0D scalar, 1D line, 2D plane, 3D volume) using the CGA space object. It shows how to provide weight and Euclidean components (scalar, vector, bivector, trivector). ```c# // Create a 5-dimensional CGA space var cga = RGaConformalSpace.Create(5); // Define a weighted direction from a scalar, // only the sign of the scalar is used // This is a kind of "signed point at the origin" // or "signed 0D subspace" geometry var d0 = cga.DefineDirectionScalar( 2.1, -3.4 ); // Define a weighted 1D direction based on a // 3D vector. Internally, the vector is // normalized to a unit vector var d1 = cga.DefineDirectionLine( 2.1, Float64Vector3D.Create(-1, -1.2, -3) ); // Define a weighted 2D direction from a 3D bivector var d2 = cga.DefineDirectionPlane( 2.1, Float64Bivector3D.Create(-1.4, -1.3, -2.1) ); // Define a weighted 3D direction from a 3D trivector. // only the sign of the scalar is used here. var d3 = cga.DefineDirectionVolume( 2.1, Float64Trivector3D.Create(-3.4) ); ``` -------------------------------- ### Template: Main Blade Equality Method (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Applications.Symbolic/LibraryGenerators/CSharp/DirectCSharpComposer/BladesLibraryEquals.txt A template for generating the main C# `Equals` method for a geometric algebra blade type (`cga5dBlade`). It handles null checks, reference equality, zero blades, grade comparison, and then uses a switch statement (populated by 'main_equals_case' templates) to delegate the comparison based on the blade's grade. ```C# public bool Equals(cga5dBlade blade2) { if ((object)blade2 == null) return false; if (ReferenceEquals(this, blade2)) return true; if (IsZeroBlade) return blade2.IsZero; if (blade2.IsZeroBlade) return IsZero; if (Grade != blade2.Grade) return false; switch (Grade) { #cases# } throw new InvalidDataException("Internal error. Blade grade not acceptable!"); } ``` -------------------------------- ### Template: Coefficient Comparison Case (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Applications.Symbolic/LibraryGenerators/CSharp/DirectCSharpComposer/BladesLibraryEquals.txt A template snippet used within a loop to generate code for comparing individual coefficients of two arrays. It checks if the absolute difference between coefficients exceeds a small epsilon value. ```C# c = coefs1[#num#] - coefs2[#num#]; if (c <= -Epsilon || c >= Epsilon) return false; ``` -------------------------------- ### Direct Intersection of CGA Elements (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md This snippet shows a simplified approach to intersecting two CGA elements (like a plane and a sphere) using a dedicated `Intersect` method provided by the element classes. This is a more direct and often preferred method compared to manually working with blades. ```C# var intersectionElement = plane.Intersect(sphere); ``` -------------------------------- ### Template: Main Equality Switch Case (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Applications.Symbolic/LibraryGenerators/CSharp/DirectCSharpComposer/BladesLibraryEquals.txt A template snippet for generating a 'case' statement within a switch block. This case handles a specific 'Grade' of a geometric algebra blade and calls a generated equality check method specific to that grade. ```C# case #grade#: return Equals#num#(Coefs, blade2.Coefs); ``` -------------------------------- ### Defining a Flat Plane - CGA - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Illustrates how to create a weighted 2D flat plane element. Similar to tangents, it takes a weight, a 3D position vector, and a 3D direction bivector, which is normalized internally. ```c# // Define a weighted 2D flat plane based on a 3D // direction bivector and a 3D position. // Internally, the bivector is normalized to a // unit bivector var f2 = cga.DefineFlatPlane( 2.1, Float64Vector3D.Create(-1.3, -2.1, -1.1), Float64Bivector3D.Create(-1.4, -1.3, -2.1) ); ``` -------------------------------- ### Defining a Tangent Plane - CGA - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Shows how to create a weighted 2D tangent plane element. It requires a weight, a 3D position vector, and a 3D direction bivector. The direction bivector is normalized internally. ```c# // Define a weighted 2D tangent plane based on a 3D // direction bivector and a 3D position. // Internally, the bivector is normalized to a // unit bivector var t2 = cga.DefineTangentPlane( 2.1, Float64Vector3D.Create(-1.3, -2.1, -1.1), Float64Bivector3D.Create(-1.4, -1.3, -2.1) ); ``` -------------------------------- ### Defining a Round Circle - CGA - C# Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md Demonstrates how to create a weighted round circle element. It requires a weight, a squared radius, a 3D center position vector, and a 3D direction bivector. The direction bivector is normalized internally. ```c# // Define an imaginary weighted circle based on a 3D // direction bivector and a 3D center position. // Internally, the bivector is normalized to a // unit bivector var r2 = cga.DefineRoundCircle( 2.1, // weight -9, // squared radius Float64Vector3D.Create(-1.3, -2.1, -1.1), // center Float64Bivector3D.Create(-1.4, -1.3, -2.1) // direction ); ``` -------------------------------- ### Template: Array Equality Check Method (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Applications.Symbolic/LibraryGenerators/CSharp/DirectCSharpComposer/BladesLibraryEquals.txt A template for generating a static C# method that compares two arrays of doubles for equality, likely used for comparing coefficient arrays of geometric algebra blades. It iterates through coefficients, potentially using the 'equals_case' template for the comparison logic. ```C# private static bool Equals1(#double#[] coefs1, #double#[] coefs2) { #double# c; #cases# return true; } ``` -------------------------------- ### Intersecting Sphere and Plane using IPNS Blades (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md This snippet demonstrates how to intersect a sphere and a plane in Conformal Geometric Algebra (CGA) by manually encoding them as IPNS blades. It uses the outer product (`Op`) to compute the intersection blade and then decodes the resulting blade back into a CGA element. Requires the `RGaConformalSpace` and related classes. ```C# var cga = RGaConformalSpace.Create(5); // Define a plane in 3-dimensions using distance from origin and normal vector var plane = cga.DefineFlatPlane( 3, Float64Vector3D.Create(1, 2, -1) ); // Define a real sphere with radius 5 var sphere = cga.DefineRealRoundSphere( 5, Float64Vector3D.Create(1, 1, 1) ); // Get the IPNS blades for the plane and sphere var planeBlade = plane.EncodeIpnsBlade(); var sphereBlade = sphere.EncodeIpnsBlade(); // Compute the IPNS blade of intersection using the outer product var intersectionBlade = sphereBlade.Op(planeBlade); // Decode the blade of intersection into a CGA element var intersectionElement = intersectionBlade.DecodeIpnsElement(); ``` -------------------------------- ### Encoding and Intersecting CGA Blades Directly (C#) Source: https://github.com/ga-explorer/geometricalgebrafulcrumlib/blob/main/GeometricAlgebraFulcrumLib/GeometricAlgebraFulcrumLib.Modeling/Geometry/CGa/Float64/Conformal Geometry.md This snippet illustrates how to directly encode geometric objects, such as a plane and a sphere, into IPNS blades using Euclidean components without first defining them as full CGA elements. It then performs the intersection using the outer product (`Op`) on the resulting blades. ```C# var cga = RGaConformalSpace.Create(5); // Encode a plane in 3-dimensions as a IPNS blade var planeBlade = cga.EncodeIpnsFlatPlane( 3, Float64Vector3D.Create(1, 2, -1) ); // Encode a real sphere with radius 5 as a IPNS blade var sphereBlade = cga.EncodeIpnsRealRoundSphere( 5, Float64Vector3D.Create(1, 1, 1) ); // Compute the IPNS blade of intersection using the outer product var intersectionBlade = sphereBlade.Op(planeBlade); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.