/// <summary> /// Rotate the object around x y and z in the order of z y and x. /// </summary> /// <remark> /// Values are given in degrees. /// </remark> /// <param name="original">SDF to rotate.</param> /// <param name="xrotation">Rotation around x-axis given in degrees.</param> /// <param name="yrotation">Rotation around y-axis given in degrees.</param> /// <param name="zrotation">Rotation around z-axis given in degrees.</param> public Rotation(SDF original, int xdegrees, int ydegrees, int zdegrees) { _original = original; x = (float)(xdegrees % 360 * Math.PI) / 180; y = (float)(ydegrees % 360 * Math.PI) / 180; z = (float)(zdegrees % 360 * Math.PI) / 180; Initialize(); }
/// <summary> /// Rotate the object around x y and z in the order of z y and x. /// </summary> /// <remark> /// Values are given in radians. /// </remark> /// <param name="original">SDF to rotate.</param> /// <param name="xrotation">Rotation around x-axis given in radians.</param> /// <param name="yrotation">Rotation around y-axis given in radians.</param> /// <param name="zrotation">Rotation around z-axis given in radians.</param> public Rotation(SDF original, float xrotation, float yrotation, float zrotation) { _original = original; x = xrotation; y = yrotation; z = zrotation; Initialize(); }
/// <summary> /// Creates the intersection between two objects. /// </summary> public Intersection(SDF first, SDF second) { _fst = first; _snd = second; }
/// <summary> /// Moves an object the desired distance. /// </summary> /// <param name="original">The original object.</param> /// <param name="transform">The x, y and z distances used to move the object.</param> public Transformation(SDF original, Vec3 transform) { _original = original; _tranform = transform; }
/// <summary> /// Scales a SDF with a given value. /// </summary> /// <remarks> /// A value larger than 1 enlarges the object. /// A value between 0 and 1 shrinks the object. /// Negative values have unspecified behavior. /// </remarks> /// <param name="original">The original SDF.</param> /// <param name="scaleValue">The scale value.</param> public Scaling(SDF original, float scaleValue) { _original = original; scale = scaleValue; }
/// <summary> /// Substract one object from another. /// </summary> /// <param name="first">The original object.</param> /// <param name="second">The object to be removed.</param> public Subtraction(SDF first, SDF second) { _fst = first; _snd = second; }
/// <summary> /// Combines two objects. /// </summary> /// <param name="first">The original object.</param> /// <param name="second">The object to be added.</param> public Union(SDF first, SDF second) { _fst = first; _snd = second; }
/// <summary> /// Applies a displacement function to an object. /// </summary> /// <remarks> /// The displacement function should be determinitic to ensure a correct object. /// </remarks> /// <param name="original">The original object.</param> /// <param name="displacement">The displacement function.</param> public Displacement(SDF original, Func <Vec3, float> displacement) { _original = original; _displacement = displacement; }